merge mainline into lazy
This commit is contained in:
commit
00542307eb
326 changed files with 18667 additions and 4092 deletions
259
include/grub/arc/arc.h
Normal file
259
include/grub/arc/arc.h
Normal file
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* 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,
|
||||
};
|
||||
|
||||
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, 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. */
|
||||
|
@ -128,47 +179,42 @@ struct grub_ata_device
|
|||
/* Set to 0 for ATA, set to 1 for ATAPI. */
|
||||
int atapi;
|
||||
|
||||
struct grub_ata_device *next;
|
||||
int dma;
|
||||
|
||||
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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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,11 +75,15 @@
|
|||
#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_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
|
||||
|
|
|
@ -51,5 +51,85 @@ 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 1971 instead of 1970 */
|
||||
ret = SECPERYEAR + SECPERDAY;
|
||||
|
||||
/* Transform C divisions and modulos to mathematical ones */
|
||||
y4 = (datetime->year - 1971) / 4;
|
||||
if (datetime->year < 1971)
|
||||
y4--;
|
||||
ay = datetime->year - 1971 - 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__)
|
||||
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 */
|
||||
|
|
|
@ -23,4 +23,8 @@ grub_ssize_t
|
|||
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
|
||||
char *outbuf, grub_size_t outsize);
|
||||
|
||||
grub_err_t
|
||||
grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
grub_off_t off, char *outbuf, grub_size_t outsize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
struct grub_disk;
|
||||
struct grub_net;
|
||||
struct grub_fs;
|
||||
|
||||
struct grub_device
|
||||
{
|
||||
|
|
|
@ -42,7 +42,8 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_PXE_ID,
|
||||
GRUB_DISK_DEVICE_SCSI_ID,
|
||||
GRUB_DISK_DEVICE_FILE_ID,
|
||||
GRUB_DISK_DEVICE_LUKS_ID
|
||||
GRUB_DISK_DEVICE_LUKS_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
@ -111,6 +112,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;
|
||||
|
||||
|
@ -143,9 +147,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
|
||||
|
@ -175,17 +180,6 @@ grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
|
|||
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_mdraid09_init (void);
|
||||
|
|
|
@ -54,21 +54,6 @@ 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
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
@ -85,6 +70,15 @@ __asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
|
|||
#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
|
||||
|
@ -96,6 +90,9 @@ __asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
|
|||
#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"; \
|
||||
|
@ -139,6 +136,11 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
#ifdef __ia64__
|
||||
void *got;
|
||||
void *tramp;
|
||||
#endif
|
||||
void *base;
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
@ -156,7 +158,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);
|
||||
|
@ -166,6 +168,20 @@ 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);
|
||||
|
||||
#ifdef __ia64__
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 16
|
||||
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
|
||||
#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 } \
|
||||
|
@ -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,74 @@ 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);
|
||||
void (*getstatus) (void);
|
||||
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 +1342,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 +1351,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 +1359,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 +1401,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,14 @@ 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);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
void grub_efi_init (void);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
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);
|
||||
|
|
@ -56,6 +56,10 @@ typedef enum
|
|||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED,
|
||||
GRUB_ERR_EXTRACTOR,
|
||||
GRUB_ERR_NET_BAD_ADDRESS,
|
||||
GRUB_ERR_NET_ROUTE_LOOP,
|
||||
GRUB_ERR_NET_NO_ROUTE,
|
||||
GRUB_ERR_WAIT,
|
||||
GRUB_ERR_BUG
|
||||
}
|
||||
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
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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__
|
||||
|
@ -130,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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -44,6 +44,8 @@ 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 */
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -152,9 +152,9 @@
|
|||
#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
|
||||
|
@ -162,8 +162,6 @@
|
|||
|
||||
#define GRUB_PXE_TFTP_PORT 69
|
||||
|
||||
#define GRUB_PXE_VM_RFC1048 0x63825363L
|
||||
|
||||
#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
@ -214,38 +212,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 +287,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 */
|
||||
|
|
|
@ -46,6 +46,7 @@ struct grub_relocator16_state
|
|||
grub_uint16_t ss;
|
||||
grub_uint16_t sp;
|
||||
grub_uint16_t ip;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t edx;
|
||||
};
|
||||
|
||||
|
|
34
include/grub/ia64/efi/kernel.h
Normal file
34
include/grub/ia64/efi/kernel.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,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_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#ifndef ASM_FILE
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_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 */
|
25
include/grub/ia64/kernel.h
Normal file
25
include/grub/ia64/kernel.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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_CPU_KERNEL_HEADER
|
||||
#define GRUB_CPU_KERNEL_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#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 *);
|
||||
|
@ -191,11 +195,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 */
|
||||
|
|
|
@ -84,12 +84,16 @@ 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 void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
|
||||
|
||||
|
||||
#if ! defined (ASM_FILE)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
|
|
|
@ -39,8 +39,36 @@ 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
|
||||
#endif
|
||||
|
||||
# ifdef HAVE___IA64_TRAMPOLINE
|
||||
void EXPORT_FUNC (__ia64_trampoline) (void);
|
||||
# endif
|
||||
|
||||
#ifdef HAVE___TRAMPOLINE_SETUP
|
||||
void EXPORT_FUNC (__trampoline_setup) (void);
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,6 @@ void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func)
|
|||
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) (void *hnd);
|
||||
|
||||
#endif /* ! GRUB_LOADER_HEADER */
|
||||
|
|
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
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif
|
|
@ -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,7 +64,6 @@
|
|||
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
|
||||
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
|
||||
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
|
||||
|
@ -85,6 +80,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
|
||||
|
|
34
include/grub/mips/loongson/kernel.h
Normal file
34
include/grub/mips/loongson/kernel.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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_MACHINE_HEADER
|
||||
#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_FULOONG 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -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,9 +43,6 @@ 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);
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
#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_LOONGSON_OHCI_GHOST_FUNCTION 4
|
||||
#define GRUB_LOONGSON_EHCI_GHOST_FUNCTION 5
|
||||
|
||||
#define GRUB_PCI_NUM_BUS 1
|
||||
#define GRUB_PCI_NUM_DEVICES 16
|
|
@ -19,11 +19,14 @@
|
|||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT 0xbff003f8
|
||||
#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_PORT }
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT0, GRUB_MACHINE_SERIAL_PORT1, GRUB_MACHINE_SERIAL_PORT2 }
|
||||
#else
|
||||
#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);
|
||||
|
||||
#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,12 @@
|
|||
#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;
|
||||
|
||||
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);
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -287,20 +287,9 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
|
|||
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result));
|
||||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64_full) (grub_uint64_t n,
|
||||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
static inline grub_uint64_t grub_divmod64 (grub_uint64_t n,
|
||||
grub_uint32_t d,
|
||||
grub_uint32_t *r)
|
||||
{
|
||||
grub_uint64_t ret, rr;
|
||||
|
||||
ret = grub_divmod64_full (n, d, &rr);
|
||||
if (r)
|
||||
*r = rr;
|
||||
return ret;
|
||||
}
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
||||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
|
||||
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
|
||||
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2010,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
|
||||
|
@ -19,54 +19,432 @@
|
|||
#ifndef GRUB_NET_HEADER
|
||||
#define GRUB_NET_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/net/netbuff.h>
|
||||
|
||||
struct grub_net;
|
||||
|
||||
struct grub_net_dev
|
||||
typedef enum grub_link_level_protocol_id
|
||||
{
|
||||
/* The device name. */
|
||||
const char *name;
|
||||
GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
||||
} grub_link_level_protocol_id_t;
|
||||
|
||||
/* FIXME: Just a template. */
|
||||
int (*probe) (struct grub_net *net, const void *addr);
|
||||
void (*reset) (struct grub_net *net);
|
||||
int (*poll) (struct grub_net *net);
|
||||
void (*transmit) (struct grub_net *net, const void *destip,
|
||||
unsigned srcsock, unsigned destsock, const void *packet);
|
||||
void (*disable) (struct grub_net *net);
|
||||
typedef struct grub_net_link_level_address
|
||||
{
|
||||
grub_link_level_protocol_id_t type;
|
||||
union
|
||||
{
|
||||
grub_uint8_t mac[6];
|
||||
};
|
||||
} grub_net_link_level_address_t;
|
||||
|
||||
/* The next net device. */
|
||||
struct grub_net_dev *next;
|
||||
typedef enum grub_net_interface_flags
|
||||
{
|
||||
GRUB_NET_INTERFACE_HWADDRESS_IMMUTABLE = 1,
|
||||
GRUB_NET_INTERFACE_ADDRESS_IMMUTABLE = 2,
|
||||
GRUB_NET_INTERFACE_PERMANENT = 4
|
||||
} grub_net_interface_flags_t;
|
||||
|
||||
typedef enum grub_net_card_flags
|
||||
{
|
||||
GRUB_NET_CARD_HWADDRESS_IMMUTABLE = 1,
|
||||
GRUB_NET_CARD_NO_MANUAL_INTERFACES = 2
|
||||
} grub_net_card_flags_t;
|
||||
|
||||
struct grub_net_card;
|
||||
|
||||
struct grub_net_card_driver
|
||||
{
|
||||
struct grub_net_card_driver *next;
|
||||
char *name;
|
||||
grub_err_t (*open) (const struct grub_net_card *dev);
|
||||
void (*close) (const struct grub_net_card *dev);
|
||||
grub_err_t (*send) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
grub_ssize_t (*recv) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
};
|
||||
typedef struct grub_net_dev *grub_net_dev_t;
|
||||
|
||||
struct grub_fs;
|
||||
|
||||
struct grub_net
|
||||
typedef struct grub_net_packet
|
||||
{
|
||||
/* The net name. */
|
||||
const char *name;
|
||||
struct grub_net_packet *next;
|
||||
struct grub_net_packet *prev;
|
||||
struct grub_net_packets *up;
|
||||
struct grub_net_buff *nb;
|
||||
} grub_net_packet_t;
|
||||
|
||||
/* The underlying disk device. */
|
||||
grub_net_dev_t dev;
|
||||
typedef struct grub_net_packets
|
||||
{
|
||||
grub_net_packet_t *first;
|
||||
grub_net_packet_t *last;
|
||||
} grub_net_packets_t;
|
||||
|
||||
/* The binding filesystem. */
|
||||
struct grub_fs *fs;
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/api.h>
|
||||
#endif
|
||||
|
||||
/* FIXME: More data would be required, such as an IP address, a mask,
|
||||
a gateway, etc. */
|
||||
struct grub_net_card
|
||||
{
|
||||
struct grub_net_card *next;
|
||||
char *name;
|
||||
struct grub_net_card_driver *driver;
|
||||
grub_net_link_level_address_t default_address;
|
||||
grub_net_card_flags_t flags;
|
||||
int num_ifaces;
|
||||
int opened;
|
||||
unsigned idle_poll_delay_ms;
|
||||
grub_uint64_t last_poll;
|
||||
union
|
||||
{
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
struct
|
||||
{
|
||||
struct grub_efi_simple_network *efi_net;
|
||||
grub_efi_handle_t efi_handle;
|
||||
};
|
||||
#endif
|
||||
void *data;
|
||||
int data_num;
|
||||
};
|
||||
};
|
||||
|
||||
/* Device-specific data. */
|
||||
struct grub_net_network_level_interface;
|
||||
|
||||
typedef enum grub_network_level_protocol_id
|
||||
{
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
|
||||
} grub_network_level_protocol_id_t;
|
||||
|
||||
typedef struct grub_net_network_level_address
|
||||
{
|
||||
grub_network_level_protocol_id_t type;
|
||||
union
|
||||
{
|
||||
grub_uint32_t ipv4;
|
||||
};
|
||||
} grub_net_network_level_address_t;
|
||||
|
||||
typedef struct grub_net_network_level_netaddress
|
||||
{
|
||||
grub_network_level_protocol_id_t type;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
grub_uint32_t base;
|
||||
int masksize;
|
||||
} ipv4;
|
||||
};
|
||||
} grub_net_network_level_netaddress_t;
|
||||
|
||||
#define FOR_PACKETS(cont,var) for (var = (cont).first; var; var = var->next)
|
||||
|
||||
static inline grub_err_t
|
||||
grub_net_put_packet (grub_net_packets_t *pkts, struct grub_net_buff *nb)
|
||||
{
|
||||
struct grub_net_packet *n;
|
||||
|
||||
n = grub_malloc (sizeof (*n));
|
||||
if (!n)
|
||||
return grub_errno;
|
||||
|
||||
n->nb = nb;
|
||||
n->next = NULL;
|
||||
n->prev = NULL;
|
||||
n->up = pkts;
|
||||
if (pkts->first)
|
||||
{
|
||||
pkts->last->next = n;
|
||||
pkts->last = n;
|
||||
n->prev = pkts->last;
|
||||
}
|
||||
else
|
||||
pkts->first = pkts->last = n;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_net_remove_packet (grub_net_packet_t *pkt)
|
||||
{
|
||||
if (pkt->prev)
|
||||
pkt->prev->next = pkt->next;
|
||||
else
|
||||
pkt->up->first = pkt->next;
|
||||
if (pkt->next)
|
||||
pkt->next->prev = pkt->prev;
|
||||
else
|
||||
pkt->up->last = pkt->prev;
|
||||
grub_free (pkt);
|
||||
}
|
||||
|
||||
typedef struct grub_net_app_protocol *grub_net_app_level_t;
|
||||
|
||||
typedef struct grub_net_socket *grub_net_socket_t;
|
||||
|
||||
struct grub_net_app_protocol
|
||||
{
|
||||
struct grub_net_app_protocol *next;
|
||||
char *name;
|
||||
grub_err_t (*dir) (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
const struct grub_dirhook_info *info));
|
||||
grub_err_t (*open) (struct grub_file *file, const char *filename);
|
||||
grub_err_t (*close) (struct grub_file *file);
|
||||
};
|
||||
|
||||
struct grub_net_socket
|
||||
{
|
||||
struct grub_net_socket *next;
|
||||
|
||||
enum { GRUB_NET_SOCKET_START,
|
||||
GRUB_NET_SOCKET_ESTABLISHED,
|
||||
GRUB_NET_SOCKET_CLOSED } x_status;
|
||||
int x_in_port;
|
||||
int x_out_port;
|
||||
grub_err_t (*recv_hook) (grub_net_socket_t sock, struct grub_net_buff *nb,
|
||||
void *recv);
|
||||
void *recv_hook_data;
|
||||
grub_net_network_level_address_t x_out_nla;
|
||||
struct grub_net_network_level_interface *x_inf;
|
||||
};
|
||||
|
||||
extern struct grub_net_socket *grub_net_sockets;
|
||||
|
||||
static inline void
|
||||
grub_net_socket_register (grub_net_socket_t sock)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_net_sockets),
|
||||
GRUB_AS_LIST (sock));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_net_socket_unregister (grub_net_socket_t sock)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_net_sockets),
|
||||
GRUB_AS_LIST (sock));
|
||||
}
|
||||
|
||||
#define FOR_NET_SOCKETS(var) for (var = grub_net_sockets; var; var = var->next)
|
||||
|
||||
typedef struct grub_net
|
||||
{
|
||||
char *server;
|
||||
char *name;
|
||||
grub_net_app_level_t protocol;
|
||||
grub_net_packets_t packs;
|
||||
grub_off_t offset;
|
||||
grub_fs_t fs;
|
||||
int eof;
|
||||
} *grub_net_t;
|
||||
|
||||
extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name);
|
||||
|
||||
struct grub_net_network_level_interface
|
||||
{
|
||||
struct grub_net_network_level_interface *next;
|
||||
struct grub_net_network_level_interface **prev;
|
||||
char *name;
|
||||
struct grub_net_card *card;
|
||||
grub_net_network_level_address_t address;
|
||||
grub_net_link_level_address_t hwaddress;
|
||||
grub_net_interface_flags_t flags;
|
||||
struct grub_net_bootp_packet *dhcp_ack;
|
||||
grub_size_t dhcp_acklen;
|
||||
void *data;
|
||||
};
|
||||
typedef struct grub_net *grub_net_t;
|
||||
|
||||
/* FIXME: How to abstract networks? More consideration is necessary. */
|
||||
struct grub_net_session;
|
||||
|
||||
/* Note: Networks are very different from disks, because networks must
|
||||
be initialized before used, and the status is persistent. */
|
||||
struct grub_net_session_level_protocol
|
||||
{
|
||||
void (*close) (struct grub_net_session *session);
|
||||
grub_ssize_t (*recv) (struct grub_net_session *session, void *buf,
|
||||
grub_size_t size);
|
||||
grub_err_t (*send) (struct grub_net_session *session, void *buf,
|
||||
grub_size_t size);
|
||||
};
|
||||
|
||||
struct grub_net_session
|
||||
{
|
||||
struct grub_net_session_level_protocol *protocol;
|
||||
void *data;
|
||||
};
|
||||
|
||||
static inline void
|
||||
grub_net_session_close (struct grub_net_session *session)
|
||||
{
|
||||
session->protocol->close (session);
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_net_session_send (struct grub_net_session *session, void *buf,
|
||||
grub_size_t size)
|
||||
{
|
||||
return session->protocol->send (session, buf, size);
|
||||
}
|
||||
|
||||
static inline grub_ssize_t
|
||||
grub_net_session_recv (struct grub_net_session *session, void *buf,
|
||||
grub_size_t size)
|
||||
{
|
||||
return session->protocol->recv (session, buf, size);
|
||||
}
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_add_addr (const char *name,
|
||||
struct grub_net_card *card,
|
||||
grub_net_network_level_address_t addr,
|
||||
grub_net_link_level_address_t hwaddress,
|
||||
grub_net_interface_flags_t flags);
|
||||
|
||||
extern struct grub_net_network_level_interface *grub_net_network_level_interfaces;
|
||||
|
||||
extern grub_net_app_level_t grub_net_app_level_list;
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
static inline void
|
||||
grub_net_app_level_register (grub_net_app_level_t proto)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_net_app_level_list),
|
||||
GRUB_AS_LIST (proto));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_net_app_level_unregister (grub_net_app_level_t proto)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_net_app_level_list),
|
||||
GRUB_AS_LIST (proto));
|
||||
}
|
||||
|
||||
#define FOR_NET_APP_LEVEL(var) FOR_LIST_ELEMENTS((var), \
|
||||
(grub_net_app_level_list))
|
||||
|
||||
extern struct grub_net_card *grub_net_cards;
|
||||
|
||||
static inline void
|
||||
grub_net_card_register (struct grub_net_card *card)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_net_cards),
|
||||
GRUB_AS_LIST (card));
|
||||
}
|
||||
|
||||
void
|
||||
grub_net_card_unregister (struct grub_net_card *card);
|
||||
|
||||
#define FOR_NET_CARDS(var) for (var = grub_net_cards; var; var = var->next)
|
||||
#define FOR_NET_CARDS_SAFE(var, next) for (var = grub_net_cards, next = var->next; var; var = next, next = var->next)
|
||||
|
||||
|
||||
struct grub_net_session *
|
||||
grub_net_open_tcp (char *address, grub_uint16_t port);
|
||||
|
||||
grub_err_t
|
||||
grub_net_resolve_address (const char *name,
|
||||
grub_net_network_level_address_t *addr);
|
||||
|
||||
grub_err_t
|
||||
grub_net_resolve_net_address (const char *name,
|
||||
grub_net_network_level_netaddress_t *addr);
|
||||
|
||||
grub_err_t
|
||||
grub_net_route_address (grub_net_network_level_address_t addr,
|
||||
grub_net_network_level_address_t *gateway,
|
||||
struct grub_net_network_level_interface **interf);
|
||||
|
||||
|
||||
grub_err_t
|
||||
grub_net_add_route (const char *name,
|
||||
grub_net_network_level_netaddress_t target,
|
||||
struct grub_net_network_level_interface *inter);
|
||||
|
||||
grub_err_t
|
||||
grub_net_add_route_gw (const char *name,
|
||||
grub_net_network_level_netaddress_t target,
|
||||
grub_net_network_level_address_t gw);
|
||||
|
||||
|
||||
#define GRUB_NET_BOOTP_MAC_ADDR_LEN 16
|
||||
|
||||
typedef grub_uint8_t grub_net_bootp_mac_addr_t[GRUB_NET_BOOTP_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_net_bootp_packet
|
||||
{
|
||||
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_net_bootp_mac_addr_t mac_addr;
|
||||
char server_name[64];
|
||||
char boot_file[128];
|
||||
grub_uint8_t vendor[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_3 0x63
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_configure_by_dhcp_ack (const char *name,
|
||||
struct grub_net_card *card,
|
||||
grub_net_interface_flags_t flags,
|
||||
const struct grub_net_bootp_packet *bp,
|
||||
grub_size_t size,
|
||||
int is_def, char **device, char **path);
|
||||
|
||||
void
|
||||
grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card);
|
||||
|
||||
int
|
||||
grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||
const grub_net_link_level_address_t *b);
|
||||
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
IPv4: XXX.XXX.XXX.XXX
|
||||
*/
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXX.XXX.XXX.XXX")
|
||||
|
||||
void
|
||||
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
|
||||
char *buf);
|
||||
|
||||
extern struct grub_net_network_level_interface *grub_net_network_level_interfaces;
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
|
||||
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE(var,next) for (var = grub_net_network_level_interfaces, next = var->next; var; var = next, next = var->next)
|
||||
|
||||
void
|
||||
grub_net_poll_cards (unsigned time);
|
||||
|
||||
void grub_bootp_init (void);
|
||||
void grub_bootp_fini (void);
|
||||
|
||||
static inline void
|
||||
grub_net_network_level_interface_unregister (struct grub_net_network_level_interface *inter)
|
||||
{
|
||||
inter->card->num_ifaces--;
|
||||
*inter->prev = inter->next;
|
||||
if (inter->next)
|
||||
inter->next->prev = inter->prev;
|
||||
inter->next = 0;
|
||||
inter->prev = 0;
|
||||
}
|
||||
|
||||
extern char *grub_net_default_server;
|
||||
|
||||
#endif /* ! GRUB_NET_HEADER */
|
||||
|
|
36
include/grub/net/arp.h
Normal file
36
include/grub/net/arp.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef GRUB_NET_ARP_HEADER
|
||||
#define GRUB_NET_ARP_HEADER 1
|
||||
#include <grub/misc.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
enum
|
||||
{
|
||||
/* IANA ARP constant to define hardware type as ethernet. */
|
||||
GRUB_NET_ARPHRD_ETHERNET = 1
|
||||
};
|
||||
|
||||
/* ARP header operation codes */
|
||||
#define ARP_REQUEST 1
|
||||
#define ARP_REPLY 2
|
||||
|
||||
struct arp_entry {
|
||||
int avail;
|
||||
grub_net_network_level_address_t nl_address;
|
||||
grub_net_link_level_address_t ll_address;
|
||||
};
|
||||
|
||||
struct arphdr {
|
||||
grub_uint16_t hrd;
|
||||
grub_uint16_t pro;
|
||||
grub_uint8_t hln;
|
||||
grub_uint8_t pln;
|
||||
grub_uint16_t op;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
extern grub_err_t grub_net_arp_receive(struct grub_net_buff *nb);
|
||||
|
||||
extern grub_err_t grub_net_arp_resolve(struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *addr,
|
||||
grub_net_link_level_address_t *hw_addr);
|
||||
|
||||
#endif
|
40
include/grub/net/ethernet.h
Normal file
40
include/grub/net/ethernet.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,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_NET_ETHERNET_HEADER
|
||||
#define GRUB_NET_ETHERNET_HEADER 1
|
||||
#include <grub/types.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
/* IANA Ethertype */
|
||||
enum
|
||||
{
|
||||
GRUB_NET_ETHERTYPE_IP = 0x0800,
|
||||
GRUB_NET_ETHERTYPE_ARP = 0x0806
|
||||
};
|
||||
|
||||
grub_err_t
|
||||
send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
struct grub_net_buff *nb,
|
||||
grub_net_link_level_address_t target_addr,
|
||||
grub_uint16_t ethertype);
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card);
|
||||
|
||||
#endif
|
42
include/grub/net/ip.h
Normal file
42
include/grub/net/ip.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,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_NET_IP_HEADER
|
||||
#define GRUB_NET_IP_HEADER 1
|
||||
#include <grub/misc.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
enum
|
||||
{
|
||||
IP_UDP = 0x11 /* UDP protocol */
|
||||
};
|
||||
#define IP_BROADCAST 0xFFFFFFFF
|
||||
|
||||
grub_uint16_t grub_net_ip_chksum(void *ipv, int len);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip_packets (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *target,
|
||||
struct grub_net_buff *nb);
|
||||
|
||||
#endif
|
30
include/grub/net/netbuff.h
Normal file
30
include/grub/net/netbuff.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef GRUB_NETBUFF_HEADER
|
||||
#define GRUB_NETBUFF_HEADER
|
||||
|
||||
#include <grub/misc.h>
|
||||
|
||||
#define NETBUFF_ALIGN 2048
|
||||
#define NETBUFFMINLEN 64
|
||||
|
||||
struct grub_net_buff
|
||||
{
|
||||
/*Pointer to the start of the buffer*/
|
||||
char *head;
|
||||
/*Pointer to the data */
|
||||
char *data;
|
||||
/*Pointer to the tail */
|
||||
char *tail;
|
||||
/*Pointer to the end of the buffer*/
|
||||
char *end;
|
||||
};
|
||||
|
||||
grub_err_t grub_netbuff_put (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_unput (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_push (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff);
|
||||
struct grub_net_buff * grub_netbuff_alloc ( grub_size_t len );
|
||||
grub_err_t grub_netbuff_free (struct grub_net_buff *net_buff);
|
||||
|
||||
#endif
|
38
include/grub/net/udp.h
Normal file
38
include/grub/net/udp.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef GRUB_NET_UDP_HEADER
|
||||
#define GRUB_NET_UDP_HEADER 1
|
||||
#include <grub/types.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
struct udphdr
|
||||
{
|
||||
grub_uint16_t src;
|
||||
grub_uint16_t dst;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t chksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
grub_net_socket_t
|
||||
grub_net_udp_open (char *server,
|
||||
grub_uint16_t out_port,
|
||||
grub_err_t (*recv_hook) (grub_net_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void *recv_hook_data);
|
||||
|
||||
static inline void
|
||||
grub_net_udp_close (grub_net_socket_t sock)
|
||||
{
|
||||
grub_net_socket_unregister (sock);
|
||||
grub_free (sock);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_udp_packet (const grub_net_socket_t socket, struct grub_net_buff *nb);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf);
|
||||
|
||||
|
||||
#endif
|
|
@ -106,14 +106,16 @@ struct grub_ntfs_bpb
|
|||
grub_uint16_t sectors_per_track;
|
||||
grub_uint16_t num_heads;
|
||||
grub_uint32_t num_hidden_sectors;
|
||||
grub_uint32_t reserved_3[2];
|
||||
grub_uint32_t reserved_3;
|
||||
grub_uint8_t bios_drive;
|
||||
grub_uint8_t reserved_4[3];
|
||||
grub_uint64_t num_total_sectors;
|
||||
grub_uint64_t mft_lcn;
|
||||
grub_uint64_t mft_mirr_lcn;
|
||||
grub_int8_t clusters_per_mft;
|
||||
grub_int8_t reserved_4[3];
|
||||
grub_int8_t clusters_per_index;
|
||||
grub_int8_t reserved_5[3];
|
||||
grub_int8_t clusters_per_index;
|
||||
grub_int8_t reserved_6[3];
|
||||
grub_uint64_t num_serial;
|
||||
grub_uint32_t checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
@ -135,6 +137,7 @@ struct grub_fshelp_node
|
|||
struct grub_ntfs_data *data;
|
||||
char *buf;
|
||||
grub_uint64_t size;
|
||||
grub_uint64_t mtime;
|
||||
grub_uint32_t ino;
|
||||
int inode_read;
|
||||
struct grub_ntfs_attr attr;
|
||||
|
|
|
@ -100,16 +100,38 @@
|
|||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR 0x80200000
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR 0x80200000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
@ -117,6 +139,12 @@
|
|||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX_END 0x50
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX 0x50
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX_END 0xa0
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
|
||||
|
||||
|
@ -141,10 +169,14 @@
|
|||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN 0x1
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
|
@ -160,6 +192,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
|
@ -168,6 +201,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
|
||||
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_SCSI_H
|
||||
#define GRUB_SCSI_H 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
|
||||
typedef struct grub_scsi_dev *grub_scsi_dev_t;
|
||||
|
||||
void grub_scsi_dev_register (grub_scsi_dev_t dev);
|
||||
|
@ -29,9 +31,13 @@ struct grub_scsi;
|
|||
enum
|
||||
{
|
||||
GRUB_SCSI_SUBSYSTEM_USBMS,
|
||||
GRUB_SCSI_SUBSYSTEM_ATAPI
|
||||
GRUB_SCSI_SUBSYSTEM_PATA,
|
||||
GRUB_SCSI_SUBSYSTEM_AHCI,
|
||||
GRUB_SCSI_NUM_SUBSYSTEMS
|
||||
};
|
||||
|
||||
extern const char grub_scsi_names[GRUB_SCSI_NUM_SUBSYSTEMS][5];
|
||||
|
||||
#define GRUB_SCSI_ID_SUBSYSTEM_SHIFT 24
|
||||
#define GRUB_SCSI_ID_BUS_SHIFT 8
|
||||
#define GRUB_SCSI_ID_LUN_SHIFT 0
|
||||
|
@ -45,16 +51,12 @@ grub_make_scsi_id (int subsystem, int bus, int lun)
|
|||
|
||||
struct grub_scsi_dev
|
||||
{
|
||||
/* The device name. */
|
||||
const char *name;
|
||||
|
||||
grub_uint8_t id;
|
||||
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (int bus, int luns));
|
||||
int (*iterate) (int NESTED_FUNC_ATTR (*hook) (int id, int bus, int luns),
|
||||
grub_disk_pull_t pull);
|
||||
|
||||
/* Open the device named NAME, and set up SCSI. */
|
||||
grub_err_t (*open) (int bus, struct grub_scsi *scsi);
|
||||
grub_err_t (*open) (int id, int bus, struct grub_scsi *scsi);
|
||||
|
||||
/* Close the scsi device SCSI. */
|
||||
void (*close) (struct grub_scsi *scsi);
|
||||
|
|
|
@ -102,7 +102,7 @@ grub_serial_config_defaults (struct grub_serial_port *port)
|
|||
{
|
||||
struct grub_serial_config config =
|
||||
{
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
.speed = 115200,
|
||||
#else
|
||||
.speed = 9600,
|
||||
|
|
|
@ -248,6 +248,14 @@ grub_term_register_input (const char *name __attribute__ ((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_input_inactive (const char *name __attribute__ ((unused)),
|
||||
grub_term_input_t term)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_input_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_input_t term)
|
||||
|
@ -272,6 +280,14 @@ grub_term_register_output (const char *name __attribute__ ((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output_inactive (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
|
|
|
@ -27,7 +27,7 @@ char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
|
|||
grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
|
||||
const char *);
|
||||
|
||||
#define GRUB_TERMINFO_READKEY_MAX_LEN 4
|
||||
#define GRUB_TERMINFO_READKEY_MAX_LEN 6
|
||||
struct grub_terminfo_input_state
|
||||
{
|
||||
int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];
|
||||
|
|
|
@ -99,9 +99,11 @@ typedef grub_int64_t grub_ssize_t;
|
|||
|
||||
# if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# define PRIxGRUB_ADDR "lx"
|
||||
# define PRIuGRUB_SIZE "lu"
|
||||
# else
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# endif
|
||||
#else
|
||||
|
@ -110,6 +112,7 @@ typedef grub_uint32_t grub_size_t;
|
|||
typedef grub_int32_t grub_ssize_t;
|
||||
|
||||
# define PRIxGRUB_SIZE "x"
|
||||
# define PRIxGRUB_ADDR "x"
|
||||
# define PRIuGRUB_SIZE "u"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ typedef enum
|
|||
GRUB_USB_ERR_BABBLE,
|
||||
GRUB_USB_ERR_TIMEOUT,
|
||||
GRUB_USB_ERR_BITSTUFF,
|
||||
GRUB_USB_ERR_UNRECOVERABLE
|
||||
GRUB_USB_ERR_UNRECOVERABLE,
|
||||
GRUB_USB_ERR_BADDEVICE
|
||||
} grub_usb_err_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -19,7 +19,12 @@
|
|||
#ifndef GRUB_VGA_HEADER
|
||||
#define GRUB_VGA_HEADER 1
|
||||
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
#include <grub/pci.h>
|
||||
#else
|
||||
#include <grub/cpu/io.h>
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xb4000000
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -84,8 +89,8 @@ enum
|
|||
{
|
||||
GRUB_VGA_IO_MISC_COLOR = 0x01,
|
||||
GRUB_VGA_IO_MISC_ENABLE_VRAM_ACCESS = 0x02,
|
||||
GRUB_VGA_IO_MISC_EXTERNAL_CLOCK_0 = 0x08,
|
||||
GRUB_VGA_IO_MISC_28MHZ = 0x04,
|
||||
GRUB_VGA_IO_MISC_EXTERNAL_CLOCK_0 = 0x08,
|
||||
GRUB_VGA_IO_MISC_UPPER_64K = 0x20,
|
||||
GRUB_VGA_IO_MISC_NEGATIVE_HORIZ_POLARITY = 0x40,
|
||||
GRUB_VGA_IO_MISC_NEGATIVE_VERT_POLARITY = 0x80,
|
||||
|
@ -290,11 +295,24 @@ static inline void
|
|||
grub_vga_write_arx (grub_uint8_t val, grub_uint8_t addr)
|
||||
{
|
||||
grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_INPUT_STATUS1_REGISTER);
|
||||
grub_inb (GRUB_MACHINE_PCI_IO_BASE + 0x3ba);
|
||||
|
||||
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX);
|
||||
grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX_READ);
|
||||
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX);
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_vga_read_arx (grub_uint8_t addr)
|
||||
{
|
||||
grub_uint8_t val;
|
||||
grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_INPUT_STATUS1_REGISTER);
|
||||
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX);
|
||||
val = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX_READ);
|
||||
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX);
|
||||
return val;
|
||||
}
|
||||
|
||||
struct grub_video_hw_config
|
||||
{
|
||||
unsigned vertical_total;
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
specific coding format. */
|
||||
typedef grub_uint32_t grub_video_color_t;
|
||||
|
||||
/* Video color in hardware independent format. */
|
||||
typedef struct grub_video_rgba_color
|
||||
{
|
||||
grub_uint8_t red;
|
||||
grub_uint8_t green;
|
||||
grub_uint8_t blue;
|
||||
grub_uint8_t alpha;
|
||||
} grub_video_rgba_color_t;
|
||||
|
||||
/* This structure is driver specific and should not be accessed directly by
|
||||
outside code. */
|
||||
struct grub_video_render_target;
|
||||
|
@ -211,7 +220,8 @@ typedef enum grub_video_driver_id
|
|||
GRUB_VIDEO_DRIVER_VGA,
|
||||
GRUB_VIDEO_DRIVER_CIRRUS,
|
||||
GRUB_VIDEO_DRIVER_BOCHS,
|
||||
GRUB_VIDEO_DRIVER_SDL
|
||||
GRUB_VIDEO_DRIVER_SDL,
|
||||
GRUB_VIDEO_DRIVER_SIS315PRO,
|
||||
} grub_video_driver_id_t;
|
||||
|
||||
typedef enum grub_video_adapter_prio
|
||||
|
@ -428,4 +438,27 @@ grub_video_check_mode_flag (grub_video_mode_type_t flags,
|
|||
|
||||
grub_video_driver_id_t EXPORT_FUNC (grub_video_get_driver_id) (void);
|
||||
|
||||
static __inline grub_video_rgba_color_t
|
||||
grub_video_rgba_color_rgb (int r, int g, int b)
|
||||
{
|
||||
grub_video_rgba_color_t c;
|
||||
c.red = r;
|
||||
c.green = g;
|
||||
c.blue = b;
|
||||
c.alpha = 255;
|
||||
return c;
|
||||
}
|
||||
|
||||
static __inline grub_video_color_t
|
||||
grub_video_map_rgba_color (grub_video_rgba_color_t c)
|
||||
{
|
||||
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
|
||||
}
|
||||
|
||||
int EXPORT_FUNC (grub_video_get_named_color) (const char *name,
|
||||
grub_video_rgba_color_t *color);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_parse_color) (const char *s,
|
||||
grub_video_rgba_color_t *color);
|
||||
|
||||
#endif /* ! GRUB_VIDEO_HEADER */
|
||||
|
|
|
@ -77,7 +77,15 @@ enum zio_compress {
|
|||
ZIO_COMPRESS_OFF,
|
||||
ZIO_COMPRESS_LZJB,
|
||||
ZIO_COMPRESS_EMPTY,
|
||||
ZIO_COMPRESS_GZIP,
|
||||
ZIO_COMPRESS_GZIP1,
|
||||
ZIO_COMPRESS_GZIP2,
|
||||
ZIO_COMPRESS_GZIP3,
|
||||
ZIO_COMPRESS_GZIP4,
|
||||
ZIO_COMPRESS_GZIP5,
|
||||
ZIO_COMPRESS_GZIP6,
|
||||
ZIO_COMPRESS_GZIP7,
|
||||
ZIO_COMPRESS_GZIP8,
|
||||
ZIO_COMPRESS_GZIP9,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue