merge mainline into hints
This commit is contained in:
commit
17785932df
448 changed files with 43023 additions and 10176 deletions
|
@ -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,30 +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_DEV_INIT = 10000, /* Give the device 10s on first try to spinon. */
|
||||
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. */
|
||||
|
@ -120,6 +170,7 @@ struct grub_ata_device
|
|||
|
||||
/* Sector count. */
|
||||
grub_uint64_t size;
|
||||
grub_uint32_t log_sector_size;
|
||||
|
||||
/* CHS maximums. */
|
||||
grub_uint16_t cylinders;
|
||||
|
@ -129,49 +180,42 @@ struct grub_ata_device
|
|||
/* Set to 0 for ATA, set to 1 for ATAPI. */
|
||||
int atapi;
|
||||
|
||||
int present;
|
||||
int dma;
|
||||
|
||||
struct grub_ata_device *next;
|
||||
int *present;
|
||||
|
||||
void *data;
|
||||
|
||||
struct grub_ata_dev *dev;
|
||||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_ata_wait_not_busy) (struct grub_ata_device *dev,
|
||||
int milliseconds);
|
||||
grub_err_t EXPORT_FUNC(grub_ata_wait_drq) (struct grub_ata_device *dev,
|
||||
int rw, int milliseconds);
|
||||
void EXPORT_FUNC(grub_ata_pio_read) (struct grub_ata_device *dev,
|
||||
char *buf, grub_size_t size);
|
||||
typedef struct grub_ata *grub_ata_t;
|
||||
|
||||
static inline void
|
||||
grub_ata_regset (struct grub_ata_device *dev, int reg, int val)
|
||||
struct grub_ata_dev
|
||||
{
|
||||
grub_outb (val, dev->ioaddress + reg);
|
||||
}
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (int id, int bus),
|
||||
grub_disk_pull_t pull);
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_ata_regget (struct grub_ata_device *dev, int reg)
|
||||
{
|
||||
return grub_inb (dev->ioaddress + reg);
|
||||
}
|
||||
/* Open the device named NAME, and set up SCSI. */
|
||||
grub_err_t (*open) (int id, int bus, struct grub_ata *scsi);
|
||||
|
||||
static inline void
|
||||
grub_ata_regset2 (struct grub_ata_device *dev, int reg, int val)
|
||||
{
|
||||
grub_outb (val, dev->ioaddress2 + reg);
|
||||
}
|
||||
/* Close the scsi device SCSI. */
|
||||
void (*close) (struct grub_ata *ata);
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_ata_regget2 (struct grub_ata_device *dev, int reg)
|
||||
{
|
||||
return grub_inb (dev->ioaddress2 + reg);
|
||||
}
|
||||
/* Read SIZE bytes from the device SCSI into BUF after sending the
|
||||
command CMD of size CMDSIZE. */
|
||||
grub_err_t (*readwrite) (struct grub_ata *ata,
|
||||
struct grub_disk_ata_pass_through_parms *parms,
|
||||
int spinup);
|
||||
|
||||
static inline grub_err_t
|
||||
grub_ata_check_ready (struct grub_ata_device *dev)
|
||||
{
|
||||
if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & GRUB_ATA_STATUS_BUSY)
|
||||
return grub_ata_wait_not_busy (dev, GRUB_ATA_TOUT_STD);
|
||||
/* The next scsi device. */
|
||||
struct grub_ata_dev *next;
|
||||
};
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
typedef struct grub_ata_dev *grub_ata_dev_t;
|
||||
|
||||
void grub_ata_dev_register (grub_ata_dev_t dev);
|
||||
void grub_ata_dev_unregister (grub_ata_dev_t dev);
|
||||
|
||||
#endif /* ! GRUB_ATA_HEADER */
|
||||
|
|
|
@ -80,7 +80,10 @@ struct grub_partition_bsd_entry
|
|||
struct grub_partition_bsd_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
grub_uint16_t type;
|
||||
grub_uint8_t unused1[18];
|
||||
grub_uint8_t packname[16];
|
||||
grub_uint8_t unused2[92];
|
||||
grub_uint32_t magic2;
|
||||
grub_uint16_t checksum;
|
||||
grub_uint16_t num_partitions;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
|
||||
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_UTF16 4
|
||||
|
||||
#define GRUB_UCS2_LIMIT 0x10000
|
||||
#define GRUB_UTF16_UPPER_SURROGATE(code) \
|
||||
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
|
||||
|
@ -49,7 +51,7 @@ grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
|
|||
|
||||
/* Convert UTF-16 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, const grub_uint16_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
grub_uint32_t code_high = 0;
|
||||
|
@ -116,19 +118,52 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
return dest;
|
||||
}
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_LATIN1 2
|
||||
|
||||
/* Convert Latin1 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_latin1_to_utf8 (grub_uint8_t *dest, const grub_uint8_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
if (!(*src & 0x80))
|
||||
*dest++ = *src;
|
||||
else
|
||||
{
|
||||
*dest++ = (*src >> 6) | 0xC0;
|
||||
*dest++ = (*src & 0x3F) | 0x80;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Convert UCS-4 to UTF-8. */
|
||||
char *grub_ucs4_to_utf8_alloc (grub_uint32_t *src, grub_size_t size);
|
||||
char *grub_ucs4_to_utf8_alloc (const grub_uint32_t *src, grub_size_t size);
|
||||
|
||||
int
|
||||
grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
|
||||
|
||||
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||
grub_uint32_t **last_position);
|
||||
|
||||
/* Process one character from UTF8 sequence.
|
||||
At beginning set *code = 0, *count = 0. Returns 0 on failure and
|
||||
1 on success. *count holds the number of trailing bytes. */
|
||||
int
|
||||
grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count);
|
||||
|
||||
void
|
||||
grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size,
|
||||
grub_ucs4_to_utf8 (const grub_uint32_t *src, grub_size_t size,
|
||||
grub_uint8_t *dest, grub_size_t destsize);
|
||||
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
/* Returns -2 if not enough space, -1 on invalid character. */
|
||||
grub_ssize_t
|
||||
grub_encode_utf8_character (grub_uint8_t *dest, grub_uint8_t *destend,
|
||||
grub_uint32_t code);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#define GRUB_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#if !defined (__powerpc__) && !defined (__sparc__)
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/cpu/cmos.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_CMOS_INDEX_SECOND 0
|
||||
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
|
||||
|
@ -55,18 +57,56 @@ grub_num_to_bcd (grub_uint8_t a)
|
|||
return (((a / 10) << 4) + (a % 10));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_cmos_read (grub_uint8_t index)
|
||||
#if !defined (__powerpc__) && !defined (__sparc__)
|
||||
static inline grub_err_t
|
||||
grub_cmos_read (grub_uint8_t index, grub_uint8_t *val)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
return grub_inb (GRUB_CMOS_DATA_REG);
|
||||
*val = grub_inb (GRUB_CMOS_DATA_REG);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
static inline grub_err_t
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
grub_outb (value, GRUB_CMOS_DATA_REG);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#else
|
||||
grub_err_t grub_cmos_find_port (void);
|
||||
extern volatile grub_uint8_t *grub_cmos_port;
|
||||
|
||||
static inline grub_err_t
|
||||
grub_cmos_read (grub_uint8_t index, grub_uint8_t *val)
|
||||
{
|
||||
if (!grub_cmos_port)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_cmos_find_port ();
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
grub_cmos_port[0] = index;
|
||||
*val = grub_cmos_port[1];
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t val)
|
||||
{
|
||||
if (!grub_cmos_port)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_cmos_find_port ();
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
grub_cmos_port[0] = index;
|
||||
grub_cmos_port[1] = val;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_CMOS_H */
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -126,6 +127,9 @@ typedef struct gcry_cipher_spec
|
|||
gcry_cipher_decrypt_t decrypt;
|
||||
gcry_cipher_stencrypt_t stencrypt;
|
||||
gcry_cipher_stdecrypt_t stdecrypt;
|
||||
#ifdef GRUB_UTIL
|
||||
const char *modname;
|
||||
#endif
|
||||
struct gcry_cipher_spec *next;
|
||||
} gcry_cipher_spec_t;
|
||||
|
||||
|
@ -161,6 +165,9 @@ typedef struct gcry_md_spec
|
|||
grub_size_t contextsize; /* allocate this amount of context */
|
||||
/* Block size, needed for HMAC. */
|
||||
grub_size_t blocksize;
|
||||
#ifdef GRUB_UTIL
|
||||
const char *modname;
|
||||
#endif
|
||||
struct gcry_md_spec *next;
|
||||
} gcry_md_spec_t;
|
||||
|
||||
|
@ -185,26 +192,61 @@ grub_crypto_cipher_set_key (grub_crypto_cipher_handle_t cipher,
|
|||
const unsigned char *key,
|
||||
unsigned keylen);
|
||||
|
||||
void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher);
|
||||
static inline void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher)
|
||||
{
|
||||
grub_free (cipher);
|
||||
}
|
||||
|
||||
void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size);
|
||||
static inline void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size)
|
||||
{
|
||||
const grub_uint8_t *in1ptr = in1, *in2ptr = in2;
|
||||
grub_uint8_t *outptr = out;
|
||||
while (size && (((grub_addr_t) in1ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) in2ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) outptr & (sizeof (grub_uint64_t) - 1))))
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
while (size >= sizeof (grub_uint64_t))
|
||||
{
|
||||
*(grub_uint64_t *) (void *) outptr
|
||||
= (*(grub_uint64_t *) (void *) in1ptr
|
||||
^ *(grub_uint64_t *) (void *) in2ptr);
|
||||
in1ptr += sizeof (grub_uint64_t);
|
||||
in2ptr += sizeof (grub_uint64_t);
|
||||
outptr += sizeof (grub_uint64_t);
|
||||
size -= sizeof (grub_uint64_t);
|
||||
}
|
||||
while (size)
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size);
|
||||
void *out, const void *in, grub_size_t size);
|
||||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size);
|
||||
void *out, const void *in, grub_size_t size);
|
||||
gcry_err_code_t
|
||||
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size,
|
||||
void *iv_in);
|
||||
gcry_err_code_t
|
||||
grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size,
|
||||
void *out, const void *in, grub_size_t size,
|
||||
void *iv);
|
||||
void
|
||||
grub_cipher_register (gcry_cipher_spec_t *cipher);
|
||||
|
@ -229,7 +271,8 @@ struct grub_crypto_hmac_handle *
|
|||
grub_crypto_hmac_init (const struct gcry_md_spec *md,
|
||||
const void *key, grub_size_t keylen);
|
||||
void
|
||||
grub_crypto_hmac_write (struct grub_crypto_hmac_handle *hnd, void *data,
|
||||
grub_crypto_hmac_write (struct grub_crypto_hmac_handle *hnd,
|
||||
const void *data,
|
||||
grub_size_t datalen);
|
||||
gcry_err_code_t
|
||||
grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out);
|
||||
|
@ -237,18 +280,20 @@ grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out);
|
|||
gcry_err_code_t
|
||||
grub_crypto_hmac_buffer (const struct gcry_md_spec *md,
|
||||
const void *key, grub_size_t keylen,
|
||||
void *data, grub_size_t datalen, void *out);
|
||||
const void *data, grub_size_t datalen, void *out);
|
||||
|
||||
extern gcry_md_spec_t _gcry_digest_spec_md5;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha1;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha256;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha512;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_crc32;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_aes;
|
||||
#define GRUB_MD_MD5 ((const gcry_md_spec_t *) &_gcry_digest_spec_md5)
|
||||
#define GRUB_MD_SHA1 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha1)
|
||||
#define GRUB_MD_SHA256 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha256)
|
||||
#define GRUB_MD_SHA512 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha512)
|
||||
#define GRUB_MD_CRC32 ((const gcry_md_spec_t *) &_gcry_digest_spec_crc32)
|
||||
#define GRUB_CIPHER_AES ((const gcry_cipher_spec_t *) &_gcry_cipher_spec_aes)
|
||||
|
||||
/* Implement PKCS#5 PBKDF2 as per RFC 2898. The PRF to use is HMAC variant
|
||||
of digest supplied by MD. Inputs are the password P of length PLEN,
|
||||
|
@ -274,4 +319,10 @@ grub_password_get (char buf[], unsigned buf_size);
|
|||
|
||||
extern void (*grub_crypto_autoload_hook) (const char *name);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_gcry_init_all (void);
|
||||
void grub_gcry_fini_all (void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
147
include/grub/cryptodisk.h
Normal file
147
include/grub/cryptodisk.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CRYPTODISK_HEADER
|
||||
#define GRUB_CRYPTODISK_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_CRYPTODISK_MODE_ECB,
|
||||
GRUB_CRYPTODISK_MODE_CBC,
|
||||
GRUB_CRYPTODISK_MODE_PCBC,
|
||||
GRUB_CRYPTODISK_MODE_XTS,
|
||||
GRUB_CRYPTODISK_MODE_LRW
|
||||
} grub_cryptodisk_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_CRYPTODISK_MODE_IV_NULL,
|
||||
GRUB_CRYPTODISK_MODE_IV_PLAIN,
|
||||
GRUB_CRYPTODISK_MODE_IV_PLAIN64,
|
||||
GRUB_CRYPTODISK_MODE_IV_ESSIV,
|
||||
GRUB_CRYPTODISK_MODE_IV_BENBI,
|
||||
GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64,
|
||||
GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64_HASH
|
||||
} grub_cryptodisk_mode_iv_t;
|
||||
|
||||
#define GRUB_CRYPTODISK_MAX_UUID_LENGTH 71
|
||||
|
||||
#define GRUB_CRYPTODISK_GF_LOG_SIZE 7
|
||||
#define GRUB_CRYPTODISK_GF_SIZE (1U << GRUB_CRYPTODISK_GF_LOG_SIZE)
|
||||
#define GRUB_CRYPTODISK_GF_LOG_BYTES (GRUB_CRYPTODISK_GF_LOG_SIZE - 3)
|
||||
#define GRUB_CRYPTODISK_GF_BYTES (1U << GRUB_CRYPTODISK_GF_LOG_BYTES)
|
||||
|
||||
struct grub_cryptodisk;
|
||||
|
||||
typedef gcry_err_code_t
|
||||
(*grub_cryptodisk_rekey_func_t) (struct grub_cryptodisk *dev,
|
||||
grub_uint64_t zoneno);
|
||||
|
||||
struct grub_cryptodisk
|
||||
{
|
||||
struct grub_cryptodisk *next;
|
||||
|
||||
char *source;
|
||||
grub_disk_addr_t offset;
|
||||
grub_disk_addr_t total_length;
|
||||
grub_disk_t source_disk;
|
||||
int ref;
|
||||
grub_crypto_cipher_handle_t cipher;
|
||||
grub_crypto_cipher_handle_t secondary_cipher;
|
||||
grub_crypto_cipher_handle_t essiv_cipher;
|
||||
const gcry_md_spec_t *essiv_hash, *hash, *iv_hash;
|
||||
grub_cryptodisk_mode_t mode;
|
||||
grub_cryptodisk_mode_iv_t mode_iv;
|
||||
int benbi_log;
|
||||
unsigned long id, source_id;
|
||||
enum grub_disk_dev_id source_dev_id;
|
||||
char uuid[GRUB_CRYPTODISK_MAX_UUID_LENGTH + 1];
|
||||
grub_uint8_t lrw_key[GRUB_CRYPTODISK_GF_BYTES];
|
||||
grub_uint8_t *lrw_precalc;
|
||||
grub_uint8_t iv_prefix[64];
|
||||
grub_size_t iv_prefix_len;
|
||||
#ifdef GRUB_UTIL
|
||||
char *cheat;
|
||||
const char *modname;
|
||||
int cheat_fd;
|
||||
#endif
|
||||
int log_sector_size;
|
||||
grub_cryptodisk_rekey_func_t rekey;
|
||||
int rekey_shift;
|
||||
grub_uint8_t rekey_key[64];
|
||||
grub_uint64_t last_rekey;
|
||||
int rekey_derived_size;
|
||||
};
|
||||
typedef struct grub_cryptodisk *grub_cryptodisk_t;
|
||||
|
||||
struct grub_cryptodisk_dev
|
||||
{
|
||||
struct grub_cryptodisk_dev *next;
|
||||
|
||||
grub_cryptodisk_t (*scan) (grub_disk_t disk, const char *check_uuid,
|
||||
int boot_only);
|
||||
grub_err_t (*recover_key) (grub_disk_t disk, grub_cryptodisk_t dev);
|
||||
};
|
||||
typedef struct grub_cryptodisk_dev *grub_cryptodisk_dev_t;
|
||||
|
||||
extern grub_cryptodisk_dev_t EXPORT_VAR (grub_cryptodisk_list);
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
static inline void
|
||||
grub_cryptodisk_dev_register (grub_cryptodisk_dev_t cr)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_cryptodisk_list), GRUB_AS_LIST (cr));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_cryptodisk_dev_unregister (grub_cryptodisk_dev_t cr)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_cryptodisk_list), GRUB_AS_LIST (cr));
|
||||
}
|
||||
|
||||
#define FOR_CRYPTODISK_DEVS(var) FOR_LIST_ELEMENTS((var), (grub_cryptodisk_list))
|
||||
|
||||
gcry_err_code_t
|
||||
grub_cryptodisk_setkey (grub_cryptodisk_t dev,
|
||||
grub_uint8_t *key, grub_size_t keysize);
|
||||
gcry_err_code_t
|
||||
grub_cryptodisk_decrypt (struct grub_cryptodisk *dev,
|
||||
grub_uint8_t * data, grub_size_t len,
|
||||
grub_disk_addr_t sector);
|
||||
grub_err_t
|
||||
grub_cryptodisk_insert (grub_cryptodisk_t newdev, const char *name,
|
||||
grub_disk_t source);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_err_t
|
||||
grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
|
||||
grub_disk_t source, const char *cheat);
|
||||
void
|
||||
grub_util_cryptodisk_print_abstraction (grub_disk_t disk);
|
||||
char *
|
||||
grub_util_get_geli_uuid (const char *dev);
|
||||
#endif
|
||||
|
||||
grub_cryptodisk_t grub_cryptodisk_get_by_uuid (const char *uuid);
|
||||
grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk);
|
||||
|
||||
#endif
|
|
@ -77,6 +77,7 @@
|
|||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP 0x04000000
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1 0x00070000
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 0x00500000
|
||||
#define GRUB_CS5536_MSR_DIVIL_RESET 0x80000017
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK 0x80000024
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK 0x80000025
|
||||
#define GRUB_CS5536_DIVIL_LPC_INTERRUPTS 0x1002
|
||||
|
|
|
@ -46,7 +46,7 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
|||
#endif
|
||||
|
||||
int grub_get_weekday (struct grub_datetime *datetime);
|
||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
const char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
|
||||
void grub_unixtime2datetime (grub_int32_t nix,
|
||||
struct grub_datetime *datetime);
|
||||
|
@ -86,13 +86,13 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
|||
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;
|
||||
ret = 2 * SECPERYEAR + SECPERDAY;
|
||||
|
||||
/* Transform C divisions and modulos to mathematical ones */
|
||||
y4 = (datetime->year - 1971) / 4;
|
||||
if (datetime->year < 1971)
|
||||
y4 = (datetime->year - 1972) / 4;
|
||||
if (datetime->year < 1972)
|
||||
y4--;
|
||||
ay = datetime->year - 1971 - 4 * y4;
|
||||
ay = datetime->year - 1972 - 4 * y4;
|
||||
ret += y4 * SECPER4YEARS;
|
||||
ret += ay * SECPERYEAR;
|
||||
|
||||
|
@ -125,4 +125,11 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
|||
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 */
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
struct grub_disk;
|
||||
struct grub_net;
|
||||
struct grub_fs;
|
||||
|
||||
struct grub_device
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ 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_CRYPTODISK_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,14 @@ struct grub_disk;
|
|||
struct grub_disk_memberlist;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_DISK_PULL_NONE,
|
||||
GRUB_DISK_PULL_REMOVABLE,
|
||||
GRUB_DISK_PULL_RESCAN,
|
||||
GRUB_DISK_PULL_MAX
|
||||
} grub_disk_pull_t;
|
||||
|
||||
/* Disk device. */
|
||||
struct grub_disk_dev
|
||||
{
|
||||
|
@ -61,7 +69,8 @@ struct grub_disk_dev
|
|||
enum grub_disk_dev_id id;
|
||||
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (const char *name));
|
||||
int (*iterate) (int (*hook) (const char *name),
|
||||
grub_disk_pull_t pull);
|
||||
|
||||
/* Open the device named NAME, and set up DISK. */
|
||||
grub_err_t (*open) (const char *name, struct grub_disk *disk);
|
||||
|
@ -101,6 +110,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;
|
||||
|
||||
|
@ -133,9 +145,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
|
||||
|
@ -162,20 +175,14 @@ grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
|
|||
|
||||
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
|
||||
|
||||
#if DISK_CACHE_STATS
|
||||
void
|
||||
EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long *misses);
|
||||
#endif
|
||||
|
||||
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
|
||||
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
||||
|
||||
/* ATA pass through parameters and function. */
|
||||
struct grub_disk_ata_pass_through_parms
|
||||
{
|
||||
grub_uint8_t taskfile[8];
|
||||
void * buffer;
|
||||
int size;
|
||||
};
|
||||
|
||||
extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
|
||||
struct grub_disk_ata_pass_through_parms *);
|
||||
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
|
||||
void grub_lvm_init (void);
|
||||
void grub_mdraid09_init (void);
|
||||
|
|
|
@ -90,6 +90,9 @@ static const char grub_module_name_##name[] \
|
|||
#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"; \
|
||||
|
@ -133,11 +136,12 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
#ifdef __ia64__
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
void *got;
|
||||
void *tramp;
|
||||
#endif
|
||||
void *base;
|
||||
grub_size_t sz;
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
@ -173,10 +177,21 @@ 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
|
||||
#if defined (__ia64__)
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE GRUB_IA64_DL_TRAMP_SIZE
|
||||
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
|
||||
#else
|
||||
void
|
||||
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got);
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE 16
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,6 +84,16 @@
|
|||
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_SIMPLE_NETWORK_GUID \
|
||||
{ 0xa19832b9, 0xac25, 0x11d3, \
|
||||
{ 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_PXE_GUID \
|
||||
{ 0x03c4e603, 0xac28, 0x11d3, \
|
||||
{ 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_DEVICE_PATH_GUID \
|
||||
{ 0x09576e91, 0x6d3f, 0x11d2, \
|
||||
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
|
||||
|
@ -361,7 +371,7 @@ struct grub_efi_memory_descriptor
|
|||
grub_efi_virtual_address_t virtual_start;
|
||||
grub_efi_uint64_t num_pages;
|
||||
grub_efi_uint64_t attribute;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t;
|
||||
|
||||
/* Device Path definitions. */
|
||||
|
@ -406,7 +416,7 @@ struct grub_efi_pci_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
grub_efi_uint8_t device;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -415,7 +425,7 @@ struct grub_efi_pccard_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -423,10 +433,10 @@ typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
|||
struct grub_efi_memory_mapped_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_memory_type_t memory_type;
|
||||
grub_efi_uint32_t memory_type;
|
||||
grub_efi_physical_address_t start_address;
|
||||
grub_efi_physical_address_t end_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -436,7 +446,7 @@ struct grub_efi_vendor_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -445,7 +455,7 @@ struct grub_efi_controller_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t controller_number;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t;
|
||||
|
||||
/* ACPI Device Path. */
|
||||
|
@ -458,7 +468,7 @@ struct grub_efi_acpi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -469,8 +479,8 @@ struct grub_efi_expanded_acpi_device_path
|
|||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
grub_efi_uint32_t cid;
|
||||
char hidstr[1];
|
||||
};
|
||||
char hidstr[0];
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
|
||||
|
@ -493,7 +503,7 @@ struct grub_efi_atapi_device_path
|
|||
grub_efi_uint8_t primary_secondary;
|
||||
grub_efi_uint8_t slave_master;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -503,7 +513,7 @@ struct grub_efi_scsi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint16_t pun;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -514,7 +524,7 @@ struct grub_efi_fibre_channel_device_path
|
|||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t wwn;
|
||||
grub_efi_uint64_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t;
|
||||
|
||||
#define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -524,7 +534,7 @@ struct grub_efi_1394_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -534,7 +544,7 @@ struct grub_efi_usb_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t parent_port_number;
|
||||
grub_efi_uint8_t interface;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
|
||||
|
@ -547,7 +557,7 @@ struct grub_efi_usb_class_device_path
|
|||
grub_efi_uint8_t device_class;
|
||||
grub_efi_uint8_t device_subclass;
|
||||
grub_efi_uint8_t device_protocol;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t;
|
||||
|
||||
#define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -556,7 +566,7 @@ struct grub_efi_i2o_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t tid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
|
||||
|
@ -566,7 +576,7 @@ struct grub_efi_mac_address_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_mac_address_t mac_address;
|
||||
grub_efi_uint8_t if_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
|
||||
|
@ -580,7 +590,7 @@ struct grub_efi_ipv4_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
|
||||
|
@ -594,7 +604,7 @@ struct grub_efi_ipv6_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
|
||||
|
||||
#define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
|
||||
|
@ -607,7 +617,7 @@ struct grub_efi_infiniband_device_path
|
|||
grub_efi_uint64_t remote_id;
|
||||
grub_efi_uint64_t target_port_id;
|
||||
grub_efi_uint64_t device_id;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t;
|
||||
|
||||
#define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
|
||||
|
@ -620,7 +630,7 @@ struct grub_efi_uart_device_path
|
|||
grub_efi_uint8_t data_bits;
|
||||
grub_efi_uint8_t parity;
|
||||
grub_efi_uint8_t stop_bits;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
||||
|
@ -630,7 +640,7 @@ struct grub_efi_vendor_messaging_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
|
||||
|
||||
/* Media Device Path. */
|
||||
|
@ -647,7 +657,7 @@ struct grub_efi_hard_drive_device_path
|
|||
grub_efi_uint8_t partition_signature[8];
|
||||
grub_efi_uint8_t mbr_type;
|
||||
grub_efi_uint8_t signature_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -658,7 +668,7 @@ struct grub_efi_cdrom_device_path
|
|||
grub_efi_uint32_t boot_entry;
|
||||
grub_efi_lba_t partition_start;
|
||||
grub_efi_lba_t partition_size;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -668,7 +678,7 @@ struct grub_efi_vendor_media_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -677,7 +687,7 @@ struct grub_efi_file_path_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_char16_t path_name[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -686,7 +696,7 @@ struct grub_efi_protocol_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -695,7 +705,7 @@ struct grub_efi_piwg_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid __attribute__ ((packed));
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
|
||||
|
||||
|
||||
|
@ -710,7 +720,7 @@ struct grub_efi_bios_device_path
|
|||
grub_efi_uint16_t device_type;
|
||||
grub_efi_uint16_t status_flags;
|
||||
char description[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
|
||||
|
||||
struct grub_efi_open_protocol_information_entry
|
||||
|
@ -1113,6 +1123,36 @@ struct grub_efi_simple_text_output_interface
|
|||
};
|
||||
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
|
||||
|
||||
typedef grub_uint8_t grub_efi_pxe_packet_t[1472];
|
||||
|
||||
typedef struct grub_efi_pxe_mode
|
||||
{
|
||||
grub_uint8_t unused[52];
|
||||
grub_efi_pxe_packet_t dhcp_discover;
|
||||
grub_efi_pxe_packet_t dhcp_ack;
|
||||
grub_efi_pxe_packet_t proxy_offer;
|
||||
grub_efi_pxe_packet_t pxe_discover;
|
||||
grub_efi_pxe_packet_t pxe_reply;
|
||||
} grub_efi_pxe_mode_t;
|
||||
|
||||
typedef struct grub_efi_pxe
|
||||
{
|
||||
grub_uint64_t rev;
|
||||
void (*start) (void);
|
||||
void (*stop) (void);
|
||||
void (*dhcp) (void);
|
||||
void (*discover) (void);
|
||||
void (*mftp) (void);
|
||||
void (*udpwrite) (void);
|
||||
void (*udpread) (void);
|
||||
void (*setipfilter) (void);
|
||||
void (*arp) (void);
|
||||
void (*setparams) (void);
|
||||
void (*setstationip) (void);
|
||||
void (*setpackets) (void);
|
||||
struct grub_efi_pxe_mode *mode;
|
||||
} grub_efi_pxe_t;
|
||||
|
||||
#define GRUB_EFI_BLACK 0x00
|
||||
#define GRUB_EFI_BLUE 0x01
|
||||
#define GRUB_EFI_GREEN 0x02
|
||||
|
@ -1214,6 +1254,76 @@ struct grub_efi_block_io_media
|
|||
};
|
||||
typedef struct grub_efi_block_io_media grub_efi_block_io_media_t;
|
||||
|
||||
typedef grub_uint8_t grub_efi_mac_t[32];
|
||||
|
||||
struct grub_efi_simple_network_mode
|
||||
{
|
||||
grub_uint32_t state;
|
||||
grub_uint32_t hwaddr_size;
|
||||
grub_uint32_t media_header_size;
|
||||
grub_uint32_t max_packet_size;
|
||||
grub_uint32_t nvram_size;
|
||||
grub_uint32_t nvram_access_size;
|
||||
grub_uint32_t receive_filter_mask;
|
||||
grub_uint32_t receive_filter_setting;
|
||||
grub_uint32_t max_mcast_filter_count;
|
||||
grub_uint32_t mcast_filter_count;
|
||||
grub_efi_mac_t mcast_filter[16];
|
||||
grub_efi_mac_t current_address;
|
||||
grub_efi_mac_t broadcast_address;
|
||||
grub_efi_mac_t permanent_address;
|
||||
grub_uint8_t if_type;
|
||||
grub_uint8_t mac_changeable;
|
||||
grub_uint8_t multitx_supported;
|
||||
grub_uint8_t media_present_supported;
|
||||
grub_uint8_t media_present;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_EFI_NETWORK_STOPPED,
|
||||
GRUB_EFI_NETWORK_STARTED,
|
||||
GRUB_EFI_NETWORK_INITIALIZED,
|
||||
};
|
||||
|
||||
struct grub_efi_simple_network
|
||||
{
|
||||
grub_uint64_t revision;
|
||||
grub_efi_status_t (*start) (struct grub_efi_simple_network *this);
|
||||
void (*stop) (void);
|
||||
grub_efi_status_t (*initialize) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t extra_rx,
|
||||
grub_efi_uintn_t extra_tx);
|
||||
void (*reset) (void);
|
||||
void (*shutdown) (void);
|
||||
void (*receive_filters) (void);
|
||||
void (*station_address) (void);
|
||||
void (*statistics) (void);
|
||||
void (*mcastiptomac) (void);
|
||||
void (*nvdata) (void);
|
||||
grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this,
|
||||
grub_uint32_t *int_status,
|
||||
void **txbuf);
|
||||
grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t header_size,
|
||||
grub_efi_uintn_t buffer_size,
|
||||
void *buffer,
|
||||
grub_efi_mac_t *src_addr,
|
||||
grub_efi_mac_t *dest_addr,
|
||||
grub_efi_uint16_t *protocol);
|
||||
grub_efi_status_t (*receive) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t *header_size,
|
||||
grub_efi_uintn_t *buffer_size,
|
||||
void *buffer,
|
||||
grub_efi_mac_t *src_addr,
|
||||
grub_efi_mac_t *dest_addr,
|
||||
grub_uint16_t *protocol);
|
||||
void (*waitforpacket) (void);
|
||||
struct grub_efi_simple_network_mode *mode;
|
||||
};
|
||||
typedef struct grub_efi_simple_network grub_efi_simple_network_t;
|
||||
|
||||
|
||||
struct grub_efi_block_io
|
||||
{
|
||||
grub_efi_uint64_t revision;
|
||||
|
@ -1243,6 +1353,7 @@ typedef struct grub_efi_block_io grub_efi_block_io_t;
|
|||
#define efi_call_4(func, a, b, c, d) func(a, b, c, d)
|
||||
#define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e)
|
||||
#define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
|
||||
#define efi_call_7(func, a, b, c, d, e, f, g) func(a, b, c, d, e, f, g)
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) func(a, b, c, d, e, f, g, h, i, j)
|
||||
|
||||
#else
|
||||
|
@ -1250,24 +1361,31 @@ typedef struct grub_efi_block_io grub_efi_block_io_t;
|
|||
#define efi_call_0(func) \
|
||||
efi_wrap_0(func)
|
||||
#define efi_call_1(func, a) \
|
||||
efi_wrap_1(func, (grub_uint64_t) a)
|
||||
efi_wrap_1(func, (grub_uint64_t) (a))
|
||||
#define efi_call_2(func, a, b) \
|
||||
efi_wrap_2(func, (grub_uint64_t) a, (grub_uint64_t) b)
|
||||
efi_wrap_2(func, (grub_uint64_t) (a), (grub_uint64_t) (b))
|
||||
#define efi_call_3(func, a, b, c) \
|
||||
efi_wrap_3(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c)
|
||||
efi_wrap_3(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c))
|
||||
#define efi_call_4(func, a, b, c, d) \
|
||||
efi_wrap_4(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d)
|
||||
efi_wrap_4(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d))
|
||||
#define efi_call_5(func, a, b, c, d, e) \
|
||||
efi_wrap_5(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e)
|
||||
efi_wrap_5(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e))
|
||||
#define efi_call_6(func, a, b, c, d, e, f) \
|
||||
efi_wrap_6(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f)
|
||||
efi_wrap_6(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f))
|
||||
#define efi_call_7(func, a, b, c, d, e, f, g) \
|
||||
efi_wrap_7(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f), (grub_uint64_t) (g))
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
|
||||
efi_wrap_10(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f, (grub_uint64_t) g, \
|
||||
(grub_uint64_t) h, (grub_uint64_t) i, (grub_uint64_t) j)
|
||||
efi_wrap_10(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f), (grub_uint64_t) (g), (grub_uint64_t) (h), \
|
||||
(grub_uint64_t) (i), (grub_uint64_t) (j))
|
||||
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1);
|
||||
|
@ -1285,6 +1403,10 @@ grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1,
|
|||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_7) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6, grub_uint64_t arg7);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
|
|
|
@ -62,6 +62,16 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
|
|||
grub_efi_uint32_t descriptor_version,
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
|
||||
int
|
||||
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
||||
const grub_efi_device_path_t *dp2);
|
||||
|
||||
extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
|
||||
char **device,
|
||||
char **path);
|
||||
|
||||
grub_addr_t grub_efi_modules_addr (void);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
void grub_efi_init (void);
|
||||
|
|
|
@ -24,15 +24,8 @@
|
|||
|
||||
#define GRUB_MMAP_REGISTER_BY_FIRMWARE 1
|
||||
|
||||
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
|
||||
int type, int handle);
|
||||
grub_err_t grub_machine_mmap_unregister (int handle);
|
||||
|
||||
grub_uint64_t grub_mmap_get_post64 (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
|
||||
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -114,9 +114,9 @@ extern grub_efi_system_table64_t *grub_efiemu_system_table64;
|
|||
: (grub_efiemu_system_table32->x \
|
||||
= (y)))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_PTR(x) ((grub_efiemu_sizeof_uintn_t () == 8)\
|
||||
? UINT_TO_PTR \
|
||||
? (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table64->x) \
|
||||
: UINT_TO_PTR \
|
||||
: (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table32->x))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_VAR(x) ((grub_efiemu_sizeof_uintn_t () == 8) \
|
||||
? (void *) \
|
||||
|
@ -200,15 +200,9 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
|
|||
int grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
|
||||
grub_efi_memory_type_t type);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_memory_descriptor_t *memory_map,
|
||||
grub_efi_uintn_t *map_key,
|
||||
grub_efi_uintn_t *descriptor_size,
|
||||
grub_efi_uint32_t *descriptor_version);
|
||||
grub_err_t grub_efiemu_mm_unload (void);
|
||||
grub_err_t grub_efiemu_mm_do_alloc (void);
|
||||
grub_err_t grub_efiemu_mm_init (void);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
void grub_efiemu_mm_return_request (int handle);
|
||||
grub_efi_memory_type_t grub_efiemu_mm_get_type (int handle);
|
||||
|
||||
|
@ -271,8 +265,7 @@ grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
|||
int minus_handle, int ptv_needed, int size);
|
||||
grub_err_t grub_efiemu_write_sym_markers (void);
|
||||
grub_err_t grub_efiemu_pnvram (void);
|
||||
grub_err_t grub_efiemu_prepare (void);
|
||||
char *grub_efiemu_get_default_core_name (void);
|
||||
const char *grub_efiemu_get_default_core_name (void);
|
||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||
grub_err_t grub_efiemu_autocore (void);
|
||||
grub_err_t grub_efiemu_crc32 (void);
|
||||
|
|
6
include/grub/emu/export.h
Normal file
6
include/grub/emu/export.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
void EXPORT_FUNC (open64) (void);
|
||||
void EXPORT_FUNC (close) (void);
|
||||
void EXPORT_FUNC (read) (void);
|
||||
void EXPORT_FUNC (write) (void);
|
||||
void EXPORT_FUNC (ioctl) (void);
|
||||
|
|
@ -25,6 +25,8 @@ enum grub_dev_abstraction_types {
|
|||
GRUB_DEV_ABSTRACTION_NONE,
|
||||
GRUB_DEV_ABSTRACTION_LVM,
|
||||
GRUB_DEV_ABSTRACTION_RAID,
|
||||
GRUB_DEV_ABSTRACTION_LUKS,
|
||||
GRUB_DEV_ABSTRACTION_GELI,
|
||||
};
|
||||
|
||||
char *grub_find_device (const char *dir, dev_t dev);
|
||||
|
@ -34,5 +36,12 @@ char *grub_util_get_grub_dev (const char *os_dev);
|
|||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
const char *grub_util_check_block_device (const char *blk_dev);
|
||||
const char *grub_util_check_char_device (const char *blk_dev);
|
||||
#ifdef __linux__
|
||||
char **grub_util_raid_getmembers (const char *name, int bootable);
|
||||
#endif
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
void grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out,
|
||||
char **name_out);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void grub_util_biosdisk_init (const char *dev_map);
|
||||
void grub_util_biosdisk_fini (void);
|
||||
|
@ -31,5 +32,16 @@ int grub_util_biosdisk_is_floppy (grub_disk_t disk);
|
|||
const char *
|
||||
grub_util_biosdisk_get_compatibility_hint (grub_disk_t disk);
|
||||
grub_err_t grub_util_biosdisk_flush (struct grub_disk *disk);
|
||||
void grub_util_pull_device (const char *osname);
|
||||
grub_err_t
|
||||
grub_util_fd_seek (int fd, const char *name, grub_uint64_t sector);
|
||||
ssize_t grub_util_fd_read (int fd, char *buf, size_t len);
|
||||
grub_err_t
|
||||
grub_cryptodisk_cheat_mount (const char *sourcedev, const char *cheat);
|
||||
void grub_util_cryptodisk_print_uuid (grub_disk_t disk);
|
||||
#if !defined(__MINGW32__)
|
||||
grub_uint64_t
|
||||
grub_util_get_fd_sectors (int fd, unsigned *log_secsize);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
||||
|
|
|
@ -60,7 +60,7 @@ grub_util_device_is_mapped (const char *dev);
|
|||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct grub_env_var;
|
||||
|
||||
typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct grub_env_var
|
|||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
const char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
|
||||
|
|
|
@ -56,7 +56,17 @@ typedef enum
|
|||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED,
|
||||
GRUB_ERR_EXTRACTOR,
|
||||
GRUB_ERR_BUG
|
||||
GRUB_ERR_NET_BAD_ADDRESS,
|
||||
GRUB_ERR_NET_ROUTE_LOOP,
|
||||
GRUB_ERR_NET_NO_ROUTE,
|
||||
GRUB_ERR_NET_NO_ANSWER,
|
||||
GRUB_ERR_WAIT,
|
||||
GRUB_ERR_BUG,
|
||||
GRUB_ERR_NET_PORT_CLOSED,
|
||||
GRUB_ERR_NET_INVALID_RESPONSE,
|
||||
GRUB_ERR_NET_UNKNOWN_ERROR,
|
||||
GRUB_ERR_NET_PACKET_TOO_BIG,
|
||||
GRUB_ERR_NET_NO_DOMAIN
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
|
|
@ -31,8 +31,17 @@ struct grub_video_fbblit_info
|
|||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
void *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
/* Advance pointer by VAL bytes. If there is no unaligned access available,
|
||||
VAL has to be divisible by size of pointed type.
|
||||
*/
|
||||
#ifdef GRUB_HAVE_UNALIGNED_ACCESS
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) = (typeof (ptr)) ((char *) ptr + val))
|
||||
#else
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) += (val) / sizeof (*(ptr)))
|
||||
#endif
|
||||
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
|
|
@ -56,9 +56,10 @@ typedef enum grub_file_filter_id
|
|||
{
|
||||
GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_LZOPIO,
|
||||
GRUB_FILE_FILTER_MAX,
|
||||
GRUB_FILE_FILTER_COMPRESSION_FIRST = GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_LZOPIO,
|
||||
} grub_file_filter_id_t;
|
||||
|
||||
typedef grub_file_t (*grub_file_filter_t) (grub_file_t in);
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
/* For embedding types. */
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/partition.h>
|
||||
#endif
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
@ -74,6 +78,11 @@ struct grub_fs
|
|||
grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (grub_device_t device, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
|
||||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
|
|
@ -94,8 +94,8 @@ grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
|
|||
grub_addr_t *kern_end);
|
||||
|
||||
grub_err_t grub_bsd_add_meta (grub_uint32_t type,
|
||||
void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (char *filename, char *type,
|
||||
const void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (const char *filename, const char *type,
|
||||
int argc, char **argv,
|
||||
grub_addr_t addr, grub_uint32_t size);
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include <grub/memory.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SIZE 0x10000
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
|
|
|
@ -51,9 +51,11 @@
|
|||
|
||||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_CONSOLE 6
|
||||
#define NETBSD_BTINFO_SYMTAB 8
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
#define NETBSD_BTINFO_BOOTWEDGE 10
|
||||
#define NETBSD_BTINFO_MODULES 11
|
||||
#define NETBSD_BTINFO_FRAMEBUF 12
|
||||
|
||||
|
@ -83,6 +85,15 @@ struct grub_netbsd_btinfo_bootdisk
|
|||
grub_uint32_t partition;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootwedge {
|
||||
grub_uint32_t biosdev;
|
||||
grub_disk_addr_t startblk;
|
||||
grub_uint64_t nblks;
|
||||
grub_disk_addr_t matchblk;
|
||||
grub_uint64_t matchnblks;
|
||||
grub_uint8_t matchhash[16]; /* MD5 hash */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_netbsd_btinfo_symtab
|
||||
{
|
||||
grub_uint32_t nsyms;
|
||||
|
|
|
@ -26,16 +26,6 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/i386/vga_common.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
int grub_console_getkey (struct grub_term_input *term);
|
||||
grub_uint16_t grub_console_getxy (struct grub_term_output *term);
|
||||
void grub_console_gotoxy (struct grub_term_output *term,
|
||||
grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_console_cls (struct grub_term_output *term);
|
||||
void grub_console_setcursor (struct grub_term_output *term, int on);
|
||||
void grub_console_putchar (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
|
|
|
@ -45,7 +45,12 @@ struct grub_bios_int_registers
|
|||
#define GRUB_CPU_INT_FLAGS_INTERRUPT 0x200
|
||||
#define GRUB_CPU_INT_FLAGS_DIRECTION 0x400
|
||||
#define GRUB_CPU_INT_FLAGS_OVERFLOW 0x800
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#define GRUB_CPU_INT_FLAGS_DEFAULT GRUB_CPU_INT_FLAGS_INTERRUPT
|
||||
#else
|
||||
#define GRUB_CPU_INT_FLAGS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
|
||||
void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno,
|
||||
struct grub_bios_int_registers *regs);
|
||||
|
|
|
@ -29,20 +29,12 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The DOS partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_dos_part;
|
||||
extern grub_uint32_t EXPORT_VAR(grub_boot_device);
|
||||
|
||||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_VBE_MACHINE_HEADER
|
||||
#define GRUB_VBE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/video.h>
|
||||
|
||||
/* Default video mode to be used. */
|
||||
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
|
||||
|
||||
|
@ -169,6 +171,21 @@ struct grub_vbe_palette_data
|
|||
grub_uint8_t alignment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_vbe_flat_panel_info
|
||||
{
|
||||
grub_uint16_t horizontal_size;
|
||||
grub_uint16_t vertical_size;
|
||||
grub_uint16_t panel_type;
|
||||
grub_uint8_t red_bpp;
|
||||
grub_uint8_t green_bpp;
|
||||
grub_uint8_t blue_bpp;
|
||||
grub_uint8_t reserved_bpp;
|
||||
grub_uint32_t reserved_offscreen_mem_size;
|
||||
grub_vbe_farptr_t reserved_offscreen_mem_ptr;
|
||||
|
||||
grub_uint8_t reserved[14];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Prototypes for helper functions. */
|
||||
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
|
||||
grub_vbe_status_t
|
||||
|
|
|
@ -28,12 +28,6 @@
|
|||
|
||||
extern grub_addr_t grub_core_entry_addr;
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
|
|
@ -33,10 +33,4 @@
|
|||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void grub_machine_mmap_init (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! _GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* raid.h - RAID support for GRUB utils. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,11 +16,13 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_RAID_UTIL_HEADER
|
||||
#define GRUB_RAID_UTIL_HEADER 1
|
||||
#ifndef GRUB_REBOOT_H
|
||||
#define GRUB_REBOOT_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
extern grub_uint8_t grub_reboot_end[], grub_reboot_start[];
|
||||
|
||||
#ifdef __linux__
|
||||
char** grub_util_raid_getmembers (const char *name);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RAID_UTIL_HEADER */
|
||||
#endif
|
|
@ -48,6 +48,8 @@ struct grub_relocator16_state
|
|||
grub_uint16_t ip;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t edx;
|
||||
grub_uint32_t esi;
|
||||
int a20;
|
||||
};
|
||||
|
||||
struct grub_relocator64_state
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
/* i386 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
|
|
|
@ -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 *);
|
||||
|
@ -121,7 +125,7 @@ extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag);
|
|||
|
||||
|
||||
void EXPORT_FUNC(grub_ieee1275_init) (void);
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (const char *name,
|
||||
grub_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *property, void *buf,
|
||||
|
@ -169,7 +173,8 @@ int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size,
|
|||
unsigned int align, grub_addr_t *result);
|
||||
int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
const char *propname,
|
||||
const void *buf,
|
||||
grub_size_t size,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
|
||||
|
@ -179,10 +184,8 @@ int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs);
|
|||
|
||||
int EXPORT_FUNC(grub_devalias_iterate)
|
||||
(int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
int EXPORT_FUNC(grub_children_iterate) (char *devpath,
|
||||
int EXPORT_FUNC(grub_children_iterate) (const char *devpath,
|
||||
int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||
|
||||
int
|
||||
|
@ -191,11 +194,11 @@ EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
|
|||
|
||||
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
||||
|
||||
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
|
||||
(struct grub_ieee1275_devalias *
|
||||
alias));
|
||||
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path);
|
||||
|
||||
#endif /* ! GRUB_IEEE1275_HEADER */
|
||||
|
|
|
@ -26,14 +26,15 @@ enum
|
|||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
OBJ_TYPE_CONFIG,
|
||||
OBJ_TYPE_PREFIX
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
struct grub_module_header
|
||||
{
|
||||
/* The type of object. */
|
||||
grub_uint8_t type;
|
||||
grub_uint32_t type;
|
||||
/* The size of object (including this header). */
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
@ -68,14 +69,20 @@ struct grub_module_info64
|
|||
#define grub_module_info grub_module_info32
|
||||
#endif
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
extern grub_addr_t EXPORT_VAR (grub_modbase);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
#define FOR_MODULES(var) for (\
|
||||
var = grub_modbase ? (struct grub_module_header *) \
|
||||
(grub_modbase + (((struct grub_module_info *) grub_modbase)->offset)) : 0;\
|
||||
var && (grub_addr_t) var \
|
||||
< (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \
|
||||
var = (struct grub_module_header *) \
|
||||
((grub_uint32_t *) var + ((struct grub_module_header *) var)->size / 4))
|
||||
|
||||
grub_addr_t grub_modules_get_end (void);
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
void grub_main (void) __attribute__ ((noreturn));
|
||||
|
||||
/* The machine-specific initialization. This must initialize memory. */
|
||||
void grub_machine_init (void);
|
||||
|
@ -84,13 +91,12 @@ void grub_machine_init (void);
|
|||
void EXPORT_FUNC(grub_machine_fini) (void);
|
||||
|
||||
/* The machine-specific prefix initialization. */
|
||||
void grub_machine_set_prefix (void);
|
||||
void
|
||||
grub_machine_get_bootlocation (char **device, char **path);
|
||||
|
||||
/* Register all the exported symbols. This is automatically generated. */
|
||||
void grub_register_exported_symbols (void);
|
||||
|
||||
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
extern void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -53,8 +53,8 @@ struct grub_arg_option
|
|||
const char *longarg;
|
||||
int shortarg;
|
||||
int flags;
|
||||
char *doc;
|
||||
char *arg;
|
||||
const char *doc;
|
||||
const char *arg;
|
||||
grub_arg_type_t type;
|
||||
};
|
||||
|
||||
|
|
|
@ -63,6 +63,12 @@ void EXPORT_FUNC (__divsi3) (void);
|
|||
# ifdef HAVE___MODSI3
|
||||
void EXPORT_FUNC (__modsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZDI2
|
||||
void EXPORT_FUNC (__ctzdi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZSI2
|
||||
void EXPORT_FUNC (__ctzsi2) (void);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef HAVE___IA64_TRAMPOLINE
|
||||
|
|
|
@ -54,11 +54,11 @@ grub_bad_type_cast_real (int line, const char *file)
|
|||
|
||||
#define GRUB_AS_LIST(ptr) \
|
||||
(GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
|
||||
(grub_list_t) ptr : grub_bad_type_cast ())
|
||||
(grub_list_t) ptr : (grub_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_LIST_P(pptr) \
|
||||
(GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
|
||||
(grub_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
(grub_list_t *) (void *) pptr : (grub_list_t *) grub_bad_type_cast ())
|
||||
|
||||
struct grub_named_list
|
||||
{
|
||||
|
@ -73,12 +73,12 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
|
|||
#define GRUB_AS_NAMED_LIST(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t) ptr : grub_bad_type_cast ())
|
||||
(grub_named_list_t) ptr : (grub_named_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_NAMED_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
(grub_named_list_t *) (void *) pptr : (grub_named_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_PRIO_LIST_PRIO_MASK 0xff
|
||||
#define GRUB_PRIO_LIST_FLAG_ACTIVE 0x100
|
||||
|
@ -106,12 +106,14 @@ grub_prio_list_remove (grub_prio_list_t *head, grub_prio_list_t item)
|
|||
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t) ptr : grub_bad_type_cast ())
|
||||
(grub_prio_list_t) ptr \
|
||||
: (grub_prio_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_PRIO_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio)) ? \
|
||||
(grub_prio_list_t *) (void *) pptr \
|
||||
: (grub_prio_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_LIST_HEADER */
|
||||
|
|
|
@ -56,11 +56,13 @@ typedef enum {
|
|||
} grub_loader_preboot_hook_prio_t;
|
||||
|
||||
/* Register a preboot hook. */
|
||||
void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
struct grub_preboot;
|
||||
|
||||
struct grub_preboot *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
|
||||
/* Unregister given preboot hook. */
|
||||
void grub_loader_unregister_preboot_hook (void *hnd);
|
||||
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (struct grub_preboot *hnd);
|
||||
|
||||
#endif /* ! GRUB_LOADER_HEADER */
|
||||
|
|
|
@ -38,12 +38,14 @@ struct grub_lvm_pv {
|
|||
char id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *name;
|
||||
grub_disk_t disk;
|
||||
int start; /* Sector number where the data area starts. */
|
||||
grub_disk_addr_t start; /* Sector number where the data area starts. */
|
||||
struct grub_lvm_pv *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_lv {
|
||||
char *name;
|
||||
char *fullname;
|
||||
char *compatname;
|
||||
unsigned int number;
|
||||
unsigned int segment_count;
|
||||
grub_uint64_t size;
|
||||
|
|
|
@ -16,15 +16,9 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
|
||||
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
|
||||
#define GRUB_CPU_LOONGSON_COP0_PRID GRUB_CPU_REGISTER_WRAP($15)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
#ifndef GRUB_EC_MACHINE_HEADER
|
||||
#define GRUB_EC_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/pci.h>
|
||||
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
|
||||
#define GRUB_MACHINE_EC_DATA_PORT 0x383
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#define GRUB_ARCH_MACHINE_YEELOONG 0
|
||||
#define GRUB_ARCH_MACHINE_FULOONG 1
|
||||
#define GRUB_ARCH_MACHINE_FULOONG2F 1
|
||||
#define GRUB_ARCH_MACHINE_FULOONG2E 2
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
#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
|
||||
|
@ -66,7 +64,7 @@ grub_pci_read (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline grub_uint16_t
|
||||
|
@ -74,7 +72,7 @@ grub_pci_read_word (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
|
@ -82,7 +80,7 @@ grub_pci_read_byte (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -90,7 +88,7 @@ grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -98,7 +96,7 @@ grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -106,7 +104,7 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
volatile void *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,12 +16,10 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BOOT_HEADER
|
||||
#define GRUB_BOOT_HEADER 1
|
||||
#ifndef GRUB_MACHINE_AT_KEYBOARD_HEADER
|
||||
#define GRUB_MACHINE_AT_KEYBOARD_HEADER 1
|
||||
|
||||
#define GRUB_BOOT_VERSION_MAJOR 4
|
||||
#define GRUB_BOOT_VERSION_MINOR 0
|
||||
#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \
|
||||
| GRUB_BOOT_VERSION_MAJOR)
|
||||
#define KEYBOARD_REG_DATA 0xb4000060
|
||||
#define KEYBOARD_REG_STATUS 0xb4000064
|
||||
|
||||
#endif /* ! GRUB_BOOT_HEADER */
|
||||
#endif
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,14 +49,19 @@
|
|||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||
|
||||
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
|
||||
|
||||
void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
|
||||
char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
|
||||
char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
|
||||
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
static inline void *
|
||||
grub_memcpy (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
return grub_memmove (dest, src, n);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
|
@ -82,7 +87,7 @@ grub_strncat (char *dest, const char *src, int c)
|
|||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
while (c-- && (*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
|
@ -108,7 +113,53 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
|
|||
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
|
||||
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
|
||||
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
|
||||
char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
static inline char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
|
||||
|
@ -124,6 +175,18 @@ grub_isalpha (int c)
|
|||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_islower (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isupper (int c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
|
@ -136,6 +199,12 @@ grub_isdigit (int c)
|
|||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isxdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isalnum (int c)
|
||||
{
|
||||
|
@ -193,27 +262,6 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
grub_size_t grub_strlen (const char *s);
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
|
||||
|
@ -260,6 +308,26 @@ grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused
|
|||
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
|
||||
|
||||
static inline int
|
||||
|
@ -302,6 +370,20 @@ void EXPORT_FUNC (__deregister_frame_info) (void);
|
|||
|
||||
/* Inline functions. */
|
||||
|
||||
static inline char *
|
||||
grub_memchr (const void *p, int c, grub_size_t len)
|
||||
{
|
||||
const char *s = p;
|
||||
const char *e = s + len;
|
||||
|
||||
for (; s < e; s++)
|
||||
if (*s == c)
|
||||
return (char *) s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline unsigned int
|
||||
grub_abs (int x)
|
||||
{
|
||||
|
@ -337,12 +419,18 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
|||
}
|
||||
|
||||
/* Reboot the machine. */
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS)
|
||||
void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_reboot (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||
* use APM even if it is available. */
|
||||
void grub_halt (int no_apm) __attribute__ ((noreturn));
|
||||
#elif defined (__mips__)
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_halt (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
|
|
@ -72,4 +72,21 @@ void *EXPORT_FUNC(grub_debug_memalign) (const char *file, int line,
|
|||
grub_size_t align, grub_size_t size);
|
||||
#endif /* MM_DEBUG && ! GRUB_UTIL */
|
||||
|
||||
#include <grub/err.h>
|
||||
|
||||
static inline grub_err_t
|
||||
grub_extend_alloc (grub_size_t sz, grub_size_t *allocated, void **ptr)
|
||||
{
|
||||
void *n;
|
||||
if (sz < *allocated)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
*allocated = 2 * sz;
|
||||
n = grub_realloc (*ptr, *allocated);
|
||||
if (!n)
|
||||
return grub_errno;
|
||||
*ptr = n;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_MM_H */
|
||||
|
|
|
@ -42,9 +42,11 @@
|
|||
#define GRUB_PC_PARTITION_TYPE_FAT32_LBA 0xc
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
||||
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||
#define GRUB_PC_PARTITION_TYPE_PLAN9 0x39
|
||||
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
||||
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_SWAP 0x82
|
||||
#define GRUB_PC_PARTITION_TYPE_EXT2FS 0x83
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED 0x85
|
||||
#define GRUB_PC_PARTITION_TYPE_VSTAFS 0x9e
|
||||
|
|
|
@ -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,491 @@
|
|||
#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;
|
||||
enum
|
||||
{
|
||||
GRUB_NET_MAX_LINK_HEADER_SIZE = 64,
|
||||
GRUB_NET_UDP_HEADER_SIZE = 8,
|
||||
GRUB_NET_TCP_HEADER_SIZE = 20,
|
||||
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
|
||||
GRUB_NET_OUR_IPV6_HEADER_SIZE = 40,
|
||||
GRUB_NET_OUR_MAX_IP_HEADER_SIZE = 40,
|
||||
GRUB_NET_TCP_RESERVE_SIZE = GRUB_NET_TCP_HEADER_SIZE
|
||||
+ GRUB_NET_OUR_IPV4_HEADER_SIZE
|
||||
+ GRUB_NET_MAX_LINK_HEADER_SIZE
|
||||
};
|
||||
|
||||
struct grub_net_dev
|
||||
typedef enum grub_link_level_protocol_id
|
||||
{
|
||||
/* The device name. */
|
||||
GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
||||
} grub_link_level_protocol_id_t;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
const char *name;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* The next net device. */
|
||||
struct grub_net_dev *next;
|
||||
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);
|
||||
struct grub_net_buff * (*recv) (const struct grub_net_card *dev);
|
||||
};
|
||||
typedef struct grub_net_dev *grub_net_dev_t;
|
||||
|
||||
struct grub_fs;
|
||||
|
||||
struct grub_net
|
||||
typedef struct grub_net_packet
|
||||
{
|
||||
/* The net 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;
|
||||
|
||||
typedef struct grub_net_packets
|
||||
{
|
||||
grub_net_packet_t *first;
|
||||
grub_net_packet_t *last;
|
||||
} grub_net_packets_t;
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/api.h>
|
||||
#endif
|
||||
|
||||
struct grub_net_slaac_mac_list
|
||||
{
|
||||
struct grub_net_slaac_mac_list *next;
|
||||
grub_net_link_level_address_t address;
|
||||
int slaac_counter;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct grub_net_link_layer_entry;
|
||||
|
||||
struct grub_net_card
|
||||
{
|
||||
struct grub_net_card *next;
|
||||
const 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;
|
||||
grub_size_t mtu;
|
||||
struct grub_net_slaac_mac_list *slaac_list;
|
||||
grub_ssize_t new_ll_entry;
|
||||
struct grub_net_link_layer_entry *link_layer_table;
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
/* The underlying disk device. */
|
||||
grub_net_dev_t dev;
|
||||
struct grub_net_network_level_interface;
|
||||
|
||||
/* The binding filesystem. */
|
||||
struct grub_fs *fs;
|
||||
typedef enum grub_network_level_protocol_id
|
||||
{
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6
|
||||
} grub_network_level_protocol_id_t;
|
||||
|
||||
/* FIXME: More data would be required, such as an IP address, a mask,
|
||||
a gateway, etc. */
|
||||
typedef struct grub_net_network_level_address
|
||||
{
|
||||
grub_network_level_protocol_id_t type;
|
||||
union
|
||||
{
|
||||
grub_uint32_t ipv4;
|
||||
grub_uint64_t ipv6[2];
|
||||
};
|
||||
} grub_net_network_level_address_t;
|
||||
|
||||
/* Device-specific data. */
|
||||
typedef struct grub_net_network_level_netaddress
|
||||
{
|
||||
grub_network_level_protocol_id_t type;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
grub_uint32_t base;
|
||||
int masksize;
|
||||
} ipv4;
|
||||
struct {
|
||||
grub_uint64_t base[2];
|
||||
int masksize;
|
||||
} ipv6;
|
||||
};
|
||||
} 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;
|
||||
const 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 (*seek) (struct grub_file *file, grub_off_t off);
|
||||
grub_err_t (*close) (struct grub_file *file);
|
||||
};
|
||||
|
||||
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,
|
||||
const grub_net_network_level_address_t *addr,
|
||||
const 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;
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
|
||||
|
||||
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 ? var->next : 0); var; var = next, next = (var ? var->next : 0))
|
||||
|
||||
|
||||
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
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_NET_BOOTP_PAD = 0x00,
|
||||
GRUB_NET_BOOTP_ROUTER = 0x03,
|
||||
GRUB_NET_BOOTP_DNS = 0x06,
|
||||
GRUB_NET_BOOTP_HOSTNAME = 0x0c,
|
||||
GRUB_NET_BOOTP_DOMAIN = 0x0f,
|
||||
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
|
||||
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
|
||||
GRUB_NET_BOOTP_END = 0xff
|
||||
};
|
||||
|
||||
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);
|
||||
int
|
||||
grub_net_addr_cmp (const grub_net_network_level_address_t *a,
|
||||
const grub_net_network_level_address_t *b);
|
||||
|
||||
|
||||
/*
|
||||
Currently supported adresses:
|
||||
IPv4: XXX.XXX.XXX.XXX
|
||||
IPv6: XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
|
||||
*/
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
ethernet: XX:XX:XX:XX:XX:XX
|
||||
*/
|
||||
|
||||
#define GRUB_NET_MAX_STR_HWADDR_LEN (sizeof ("XX:XX:XX:XX:XX:XX"))
|
||||
|
||||
void
|
||||
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
|
||||
char *buf);
|
||||
void
|
||||
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str);
|
||||
|
||||
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 ? var->next : 0); var; var = next, next = (var ? var->next : 0))
|
||||
|
||||
void
|
||||
grub_net_poll_cards (unsigned time);
|
||||
|
||||
void grub_bootp_init (void);
|
||||
void grub_bootp_fini (void);
|
||||
|
||||
void grub_dns_init (void);
|
||||
void grub_dns_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;
|
||||
}
|
||||
|
||||
void
|
||||
grub_net_tcp_retransmit (void);
|
||||
|
||||
void
|
||||
grub_net_link_layer_add_address (struct grub_net_card *card,
|
||||
const grub_net_network_level_address_t *nl,
|
||||
const grub_net_link_level_address_t *ll,
|
||||
int override);
|
||||
int
|
||||
grub_net_link_layer_resolve_check (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
grub_err_t
|
||||
grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr,
|
||||
grub_net_link_level_address_t *hw_addr);
|
||||
grub_err_t
|
||||
grub_net_dns_lookup (const char *name,
|
||||
const struct grub_net_network_level_address *servers,
|
||||
grub_size_t n_servers,
|
||||
grub_size_t *naddresses,
|
||||
struct grub_net_network_level_address **addresses,
|
||||
int cache);
|
||||
grub_err_t
|
||||
grub_net_add_dns_server (const struct grub_net_network_level_address *s);
|
||||
void
|
||||
grub_net_remove_dns_server (const struct grub_net_network_level_address *s);
|
||||
|
||||
|
||||
extern char *grub_net_default_server;
|
||||
|
||||
#define GRUB_NET_TRIES 40
|
||||
#define GRUB_NET_INTERVAL 400
|
||||
|
||||
#endif /* ! GRUB_NET_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,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
|
||||
|
@ -16,12 +16,16 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
#ifndef GRUB_NET_ARP_HEADER
|
||||
#define GRUB_NET_ARP_HEADER 1
|
||||
#include <grub/misc.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
#include <grub/symbol.h>
|
||||
extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card);
|
||||
|
||||
/* This is an asm part of the chainloader. */
|
||||
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
|
||||
grub_err_t
|
||||
grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2007,2008 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
|
||||
|
@ -16,13 +16,26 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_VGA_MACHINE_HEADER
|
||||
#define GRUB_VGA_MACHINE_HEADER 1
|
||||
#ifndef GRUB_NET_ETHERNET_HEADER
|
||||
#define GRUB_NET_ETHERNET_HEADER 1
|
||||
#include <grub/types.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
/* IANA Ethertype */
|
||||
typedef enum
|
||||
{
|
||||
GRUB_NET_ETHERTYPE_IP = 0x0800,
|
||||
GRUB_NET_ETHERTYPE_ARP = 0x0806,
|
||||
GRUB_NET_ETHERTYPE_IP6 = 0x86DD,
|
||||
} grub_net_ethertype_t;
|
||||
|
||||
/* The VGA (at the beginning of upper memory). */
|
||||
#define GRUB_MEMORY_MACHINE_VGA_ADDR GRUB_MEMORY_MACHINE_UPPER
|
||||
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_net_ethertype_t ethertype);
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card);
|
||||
|
||||
#endif /* ! GRUB_VGA_MACHINE_HEADER */
|
||||
#endif
|
95
include/grub/net/ip.h
Normal file
95
include/grub/net/ip.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
typedef enum grub_net_ip_protocol
|
||||
{
|
||||
GRUB_NET_IP_ICMP = 1,
|
||||
GRUB_NET_IP_TCP = 6,
|
||||
GRUB_NET_IP_UDP = 17,
|
||||
GRUB_NET_IP_ICMPV6 = 58
|
||||
} grub_net_ip_protocol_t;
|
||||
#define GRUB_NET_IP_BROADCAST 0xFFFFFFFF
|
||||
|
||||
static inline grub_uint64_t
|
||||
grub_net_ipv6_get_id (const grub_net_link_level_address_t *addr)
|
||||
{
|
||||
return grub_cpu_to_be64 (((grub_uint64_t) (addr->mac[0] ^ 2) << 56)
|
||||
| ((grub_uint64_t) addr->mac[1] << 48)
|
||||
| ((grub_uint64_t) addr->mac[2] << 40)
|
||||
| 0xfffe000000ULL
|
||||
| ((grub_uint64_t) addr->mac[3] << 16)
|
||||
| ((grub_uint64_t) addr->mac[4] << 8)
|
||||
| ((grub_uint64_t) addr->mac[5]));
|
||||
}
|
||||
|
||||
grub_uint16_t grub_net_ip_chksum(void *ipv, grub_size_t len);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip_packets (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress,
|
||||
const grub_net_link_level_address_t *src_hwaddress);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *target,
|
||||
const grub_net_link_level_address_t *ll_target_addr,
|
||||
struct grub_net_buff *nb,
|
||||
grub_net_ip_protocol_t proto);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_icmp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_link_level_address_t *ll_src,
|
||||
const grub_net_network_level_address_t *src);
|
||||
grub_err_t
|
||||
grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_link_level_address_t *ll_src,
|
||||
const grub_net_network_level_address_t *source,
|
||||
const grub_net_network_level_address_t *dest,
|
||||
grub_uint8_t ttl);
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *src);
|
||||
grub_err_t
|
||||
grub_net_recv_tcp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *source);
|
||||
|
||||
grub_uint16_t
|
||||
grub_net_ip_transport_checksum (struct grub_net_buff *nb,
|
||||
grub_uint16_t proto,
|
||||
const grub_net_network_level_address_t *src,
|
||||
const grub_net_network_level_address_t *dst);
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_ipv6_get_link_local (struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddr);
|
||||
grub_err_t
|
||||
grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
|
||||
#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. */
|
||||
grub_uint8_t *head;
|
||||
/* Pointer to the data. */
|
||||
grub_uint8_t *data;
|
||||
/* Pointer to the tail. */
|
||||
grub_uint8_t *tail;
|
||||
/* Pointer to the end of the buffer. */
|
||||
grub_uint8_t *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
|
79
include/grub/net/tcp.h
Normal file
79
include/grub/net/tcp.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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_TCP_HEADER
|
||||
#define GRUB_NET_TCP_HEADER 1
|
||||
#include <grub/types.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
struct grub_net_tcp_socket;
|
||||
typedef struct grub_net_tcp_socket *grub_net_tcp_socket_t;
|
||||
|
||||
struct grub_net_tcp_listen;
|
||||
typedef struct grub_net_tcp_listen *grub_net_tcp_listen_t;
|
||||
|
||||
grub_net_tcp_socket_t
|
||||
grub_net_tcp_open (char *server,
|
||||
grub_uint16_t out_port,
|
||||
grub_err_t (*recv_hook) (grub_net_tcp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void (*error_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void (*fin_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
grub_net_tcp_listen_t
|
||||
grub_net_tcp_listen (grub_uint16_t port,
|
||||
const struct grub_net_network_level_interface *inf,
|
||||
grub_err_t (*listen_hook) (grub_net_tcp_listen_t listen,
|
||||
grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
void
|
||||
grub_net_tcp_stop_listen (grub_net_tcp_listen_t listen);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_tcp_packet (const grub_net_tcp_socket_t socket,
|
||||
struct grub_net_buff *nb,
|
||||
int push);
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_NET_TCP_CONTINUE_RECEIVING,
|
||||
GRUB_NET_TCP_DISCARD,
|
||||
GRUB_NET_TCP_ABORT
|
||||
};
|
||||
|
||||
void
|
||||
grub_net_tcp_close (grub_net_tcp_socket_t sock, int discard_received);
|
||||
|
||||
grub_err_t
|
||||
grub_net_tcp_accept (grub_net_tcp_socket_t sock,
|
||||
grub_err_t (*recv_hook) (grub_net_tcp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void (*error_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void (*fin_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
#endif
|
51
include/grub/net/udp.h
Normal file
51
include/grub/net/udp.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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_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));
|
||||
|
||||
struct grub_net_udp_socket;
|
||||
typedef struct grub_net_udp_socket *grub_net_udp_socket_t;
|
||||
|
||||
grub_net_udp_socket_t
|
||||
grub_net_udp_open (grub_net_network_level_address_t addr,
|
||||
grub_uint16_t out_port,
|
||||
grub_err_t (*recv_hook) (grub_net_udp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void *recv_hook_data);
|
||||
|
||||
void
|
||||
grub_net_udp_close (grub_net_udp_socket_t sock);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_udp_packet (const grub_net_udp_socket_t socket,
|
||||
struct grub_net_buff *nb);
|
||||
|
||||
|
||||
#endif
|
|
@ -20,79 +20,87 @@
|
|||
#ifndef GRUB_NTFS_H
|
||||
#define GRUB_NTFS_H 1
|
||||
|
||||
#define FILE_MFT 0
|
||||
#define FILE_MFTMIRR 1
|
||||
#define FILE_LOGFILE 2
|
||||
#define FILE_VOLUME 3
|
||||
#define FILE_ATTRDEF 4
|
||||
#define FILE_ROOT 5
|
||||
#define FILE_BITMAP 6
|
||||
#define FILE_BOOT 7
|
||||
#define FILE_BADCLUS 8
|
||||
#define FILE_QUOTA 9
|
||||
#define FILE_UPCASE 10
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_FILE_MFT = 0,
|
||||
GRUB_NTFS_FILE_MFTMIRR = 1,
|
||||
GRUB_NTFS_FILE_LOGFILE = 2,
|
||||
GRUB_NTFS_FILE_VOLUME = 3,
|
||||
GRUB_NTFS_FILE_ATTRDEF = 4,
|
||||
GRUB_NTFS_FILE_ROOT = 5,
|
||||
GRUB_NTFS_FILE_BITMAP = 6,
|
||||
GRUB_NTFS_FILE_BOOT = 7,
|
||||
GRUB_NTFS_FILE_BADCLUS = 8,
|
||||
GRUB_NTFS_FILE_QUOTA = 9,
|
||||
GRUB_NTFS_FILE_UPCASE = 10,
|
||||
};
|
||||
|
||||
#define AT_STANDARD_INFORMATION 0x10
|
||||
#define AT_ATTRIBUTE_LIST 0x20
|
||||
#define AT_FILENAME 0x30
|
||||
#define AT_OBJECT_ID 0x40
|
||||
#define AT_SECURITY_DESCRIPTOR 0x50
|
||||
#define AT_VOLUME_NAME 0x60
|
||||
#define AT_VOLUME_INFORMATION 0x70
|
||||
#define AT_DATA 0x80
|
||||
#define AT_INDEX_ROOT 0x90
|
||||
#define AT_INDEX_ALLOCATION 0xA0
|
||||
#define AT_BITMAP 0xB0
|
||||
#define AT_SYMLINK 0xC0
|
||||
#define AT_EA_INFORMATION 0xD0
|
||||
#define AT_EA 0xE0
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_AT_STANDARD_INFORMATION = 0x10,
|
||||
GRUB_NTFS_AT_ATTRIBUTE_LIST = 0x20,
|
||||
GRUB_NTFS_AT_FILENAME = 0x30,
|
||||
GRUB_NTFS_AT_OBJECT_ID = 0x40,
|
||||
GRUB_NTFS_AT_SECURITY_DESCRIPTOR = 0x50,
|
||||
GRUB_NTFS_AT_VOLUME_NAME = 0x60,
|
||||
GRUB_NTFS_AT_VOLUME_INFORMATION = 0x70,
|
||||
GRUB_NTFS_AT_DATA = 0x80,
|
||||
GRUB_NTFS_AT_INDEX_ROOT = 0x90,
|
||||
GRUB_NTFS_AT_INDEX_ALLOCATION = 0xA0,
|
||||
GRUB_NTFS_AT_BITMAP = 0xB0,
|
||||
GRUB_NTFS_AT_SYMLINK = 0xC0,
|
||||
GRUB_NTFS_AT_EA_INFORMATION = 0xD0,
|
||||
GRUB_NTFS_AT_EA = 0xE0,
|
||||
};
|
||||
|
||||
#define ATTR_READ_ONLY 0x1
|
||||
#define ATTR_HIDDEN 0x2
|
||||
#define ATTR_SYSTEM 0x4
|
||||
#define ATTR_ARCHIVE 0x20
|
||||
#define ATTR_DEVICE 0x40
|
||||
#define ATTR_NORMAL 0x80
|
||||
#define ATTR_TEMPORARY 0x100
|
||||
#define ATTR_SPARSE 0x200
|
||||
#define ATTR_REPARSE 0x400
|
||||
#define ATTR_COMPRESSED 0x800
|
||||
#define ATTR_OFFLINE 0x1000
|
||||
#define ATTR_NOT_INDEXED 0x2000
|
||||
#define ATTR_ENCRYPTED 0x4000
|
||||
#define ATTR_DIRECTORY 0x10000000
|
||||
#define ATTR_INDEX_VIEW 0x20000000
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_ATTR_READ_ONLY = 0x1,
|
||||
GRUB_NTFS_ATTR_HIDDEN = 0x2,
|
||||
GRUB_NTFS_ATTR_SYSTEM = 0x4,
|
||||
GRUB_NTFS_ATTR_ARCHIVE = 0x20,
|
||||
GRUB_NTFS_ATTR_DEVICE = 0x40,
|
||||
GRUB_NTFS_ATTR_NORMAL = 0x80,
|
||||
GRUB_NTFS_ATTR_TEMPORARY = 0x100,
|
||||
GRUB_NTFS_ATTR_SPARSE = 0x200,
|
||||
GRUB_NTFS_ATTR_REPARSE = 0x400,
|
||||
GRUB_NTFS_ATTR_COMPRESSED = 0x800,
|
||||
GRUB_NTFS_ATTR_OFFLINE = 0x1000,
|
||||
GRUB_NTFS_ATTR_NOT_INDEXED = 0x2000,
|
||||
GRUB_NTFS_ATTR_ENCRYPTED = 0x4000,
|
||||
GRUB_NTFS_ATTR_DIRECTORY = 0x10000000,
|
||||
GRUB_NTFS_ATTR_INDEX_VIEW = 0x20000000
|
||||
};
|
||||
|
||||
#define FLAG_COMPRESSED 1
|
||||
#define FLAG_ENCRYPTED 0x4000
|
||||
#define FLAG_SPARSE 0x8000
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_FLAG_COMPRESSED = 1,
|
||||
GRUB_NTFS_FLAG_ENCRYPTED = 0x4000,
|
||||
GRUB_NTFS_FLAG_SPARSE = 0x8000
|
||||
};
|
||||
|
||||
#define BLK_SHR GRUB_DISK_SECTOR_BITS
|
||||
#define GRUB_NTFS_BLK_SHR GRUB_DISK_SECTOR_BITS
|
||||
|
||||
#define MAX_MFT (1024 >> BLK_SHR)
|
||||
#define MAX_IDX (16384 >> BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_MFT (1024 >> GRUB_NTFS_BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_IDX (16384 >> GRUB_NTFS_BLK_SHR)
|
||||
|
||||
#define COM_LEN 4096
|
||||
#define COM_LOG_LEN 12
|
||||
#define COM_SEC (COM_LEN >> BLK_SHR)
|
||||
#define GRUB_NTFS_COM_LEN 4096
|
||||
#define GRUB_NTFS_COM_LOG_LEN 12
|
||||
#define GRUB_NTFS_COM_SEC (GRUB_NTFS_COM_LEN >> GRUB_NTFS_BLK_SHR)
|
||||
|
||||
#define AF_ALST 1
|
||||
#define AF_MMFT 2
|
||||
#define AF_GPOS 4
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_AF_ALST = 1,
|
||||
GRUB_NTFS_AF_MMFT = 2,
|
||||
GRUB_NTFS_AF_GPOS = 4,
|
||||
};
|
||||
|
||||
#define RF_COMP 1
|
||||
#define RF_CBLK 2
|
||||
#define RF_BLNK 4
|
||||
|
||||
#define valueat(buf,ofs,type) *((type*)(((char*)buf)+ofs))
|
||||
|
||||
#define u16at(buf,ofs) grub_le_to_cpu16(valueat(buf,ofs,grub_uint16_t))
|
||||
#define u32at(buf,ofs) grub_le_to_cpu32(valueat(buf,ofs,grub_uint32_t))
|
||||
#define u64at(buf,ofs) grub_le_to_cpu64(valueat(buf,ofs,grub_uint64_t))
|
||||
|
||||
#define v16at(buf,ofs) valueat(buf,ofs,grub_uint16_t)
|
||||
#define v32at(buf,ofs) valueat(buf,ofs,grub_uint32_t)
|
||||
#define v64at(buf,ofs) valueat(buf,ofs,grub_uint64_t)
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_RF_COMP = 1,
|
||||
GRUB_NTFS_RF_CBLK = 2,
|
||||
GRUB_NTFS_RF_BLNK = 4
|
||||
};
|
||||
|
||||
struct grub_ntfs_bpb
|
||||
{
|
||||
|
@ -120,8 +128,6 @@ struct grub_ntfs_bpb
|
|||
grub_uint32_t checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define grub_ntfs_file grub_fshelp_node
|
||||
|
||||
struct grub_ntfs_attr
|
||||
{
|
||||
int flags;
|
||||
|
@ -132,7 +138,7 @@ struct grub_ntfs_attr
|
|||
struct grub_ntfs_file *mft;
|
||||
};
|
||||
|
||||
struct grub_fshelp_node
|
||||
struct grub_ntfs_file
|
||||
{
|
||||
struct grub_ntfs_data *data;
|
||||
char *buf;
|
||||
|
@ -174,13 +180,15 @@ struct grub_ntfs_rlst
|
|||
struct grub_ntfs_comp comp;
|
||||
};
|
||||
|
||||
typedef grub_err_t (*ntfscomp_func_t) (struct grub_ntfs_attr * at, char *dest,
|
||||
grub_uint32_t ofs, grub_uint32_t len,
|
||||
struct grub_ntfs_rlst * ctx,
|
||||
grub_uint32_t vcn);
|
||||
typedef grub_err_t (*grub_ntfscomp_func_t) (struct grub_ntfs_attr * at,
|
||||
char *dest,
|
||||
grub_uint32_t ofs,
|
||||
grub_uint32_t len,
|
||||
struct grub_ntfs_rlst * ctx,
|
||||
grub_uint32_t vcn);
|
||||
|
||||
extern ntfscomp_func_t EXPORT_VAR (grub_ntfscomp_func);
|
||||
extern grub_ntfscomp_func_t grub_ntfscomp_func;
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_ntfs_read_run_list) (struct grub_ntfs_rlst *ctx);
|
||||
grub_err_t grub_ntfs_read_run_list (struct grub_ntfs_rlst *ctx);
|
||||
|
||||
#endif /* ! GRUB_NTFS_H */
|
||||
|
|
|
@ -19,39 +19,21 @@
|
|||
#ifndef OFFSETS_HEADER
|
||||
#define OFFSETS_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE 0x08
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
|
||||
|
||||
/* Offset of reed_solomon_redundancy. */
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x10
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xcd0
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX_END (GRUB_KERNEL_I386_PC_PREFIX + 0x40)
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x7e0
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
|
||||
|
@ -63,40 +45,16 @@
|
|||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END 0x114
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END 0x44
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
|
@ -104,62 +62,31 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
|
||||
|
||||
#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_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#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_DECOMPRESSOR_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_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_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_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
|
||||
|
||||
/* 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
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END GRUB_KERNEL_I386_COREBOOT_PREFIX_END
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
@ -169,8 +96,10 @@
|
|||
/* 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_LOONGSON_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
||||
|
@ -187,19 +116,14 @@
|
|||
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
|
||||
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
|
||||
#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)
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
|
||||
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
|
||||
#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)
|
||||
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
struct grub_parttool_argdesc
|
||||
{
|
||||
char *name;
|
||||
char *desc;
|
||||
const char *name;
|
||||
const char *desc;
|
||||
enum {GRUB_PARTTOOL_ARG_END, GRUB_PARTTOOL_ARG_BOOL, GRUB_PARTTOOL_ARG_VAL}
|
||||
type;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007,2008,2010 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,19 +16,21 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
#ifndef GRUB_PRIORITY_QUEUE_HEADER
|
||||
#define GRUB_PRIORITY_QUEUE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
struct grub_priority_queue;
|
||||
typedef struct grub_priority_queue *grub_priority_queue_t;
|
||||
typedef int (*grub_comparator_t) (const void *a, const void *b);
|
||||
|
||||
grub_priority_queue_t grub_priority_queue_new (grub_size_t elsize,
|
||||
grub_comparator_t cmp);
|
||||
void grub_priority_queue_destroy (grub_priority_queue_t pq);
|
||||
void *grub_priority_queue_top (grub_priority_queue_t pq);
|
||||
void grub_priority_queue_pop (grub_priority_queue_t pq);
|
||||
grub_err_t grub_priority_queue_push (grub_priority_queue_t pq, const void *el);
|
||||
|
||||
#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 */
|
|
@ -42,6 +42,7 @@ struct grub_raid_array
|
|||
int number; /* The device number, taken from md_minor so we
|
||||
are consistent with the device name in
|
||||
Linux. */
|
||||
int became_readable_at;
|
||||
int level; /* RAID levels, only 0, 1 or 5 at the moment. */
|
||||
int layout; /* Layout for RAID 5/6. */
|
||||
unsigned int total_devs; /* Total number of devices in the array. */
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
typedef grub_err_t (*grub_reader_getline_t) (char **, int);
|
||||
|
||||
void grub_rescue_run (void);
|
||||
void grub_rescue_run (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_READER_HEADER */
|
||||
|
|
|
@ -245,8 +245,9 @@ void grub_script_mem_free (struct grub_script_mem *mem);
|
|||
void grub_script_argv_free (struct grub_script_argv *argv);
|
||||
int grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args);
|
||||
int grub_script_argv_next (struct grub_script_argv *argv);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s,
|
||||
grub_size_t slen);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, const char *s);
|
||||
|
||||
struct grub_script_arglist *
|
||||
grub_script_create_arglist (struct grub_parser_param *state);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -96,6 +96,32 @@ grub_err_t EXPORT_FUNC(grub_serial_register) (struct grub_serial_port *port);
|
|||
|
||||
void EXPORT_FUNC(grub_serial_unregister) (struct grub_serial_port *port);
|
||||
|
||||
/* Convenience functions to perform primitive operations on a port. */
|
||||
static inline grub_err_t
|
||||
grub_serial_port_configure (struct grub_serial_port *port,
|
||||
struct grub_serial_config *config)
|
||||
{
|
||||
return port->driver->configure (port, config);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_serial_port_fetch (struct grub_serial_port *port)
|
||||
{
|
||||
return port->driver->fetch (port);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_serial_port_put (struct grub_serial_port *port, const int c)
|
||||
{
|
||||
port->driver->put (port, c);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_serial_port_fini (struct grub_serial_port *port)
|
||||
{
|
||||
port->driver->fini (port);
|
||||
}
|
||||
|
||||
/* Set default settings. */
|
||||
static inline grub_err_t
|
||||
grub_serial_config_defaults (struct grub_serial_port *port)
|
||||
|
@ -117,6 +143,7 @@ grub_serial_config_defaults (struct grub_serial_port *port)
|
|||
|
||||
void grub_ns8250_init (void);
|
||||
char *grub_serial_ns8250_add_port (grub_port_t port);
|
||||
struct grub_serial_port *grub_serial_find (const char *name);
|
||||
extern struct grub_serial_driver grub_ns8250_driver;
|
||||
void EXPORT_FUNC(grub_serial_unregister_driver) (struct grub_serial_driver *driver);
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_SIGNATURE 0xbb44aa55
|
||||
|
||||
#define GRUB_BOOT_MACHINE_VER_MAJ 0x08
|
||||
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH 0x0a
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH 0x08
|
||||
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH_END 0x80
|
||||
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -21,6 +21,6 @@
|
|||
#define GRUB_TPARM_HEADER 1
|
||||
|
||||
/* Function prototypes. */
|
||||
char *grub_terminfo_tparm (const char *string, ...);
|
||||
const char *grub_terminfo_tparm (const char *string, ...);
|
||||
|
||||
#endif /* ! GRUB_TPARM_HEADER */
|
||||
|
|
|
@ -98,13 +98,15 @@ typedef grub_uint64_t grub_size_t;
|
|||
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"
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# define PRIxGRUB_ADDR "lx"
|
||||
# define PRIuGRUB_SIZE "lu"
|
||||
# define PRIdGRUB_SSIZE "ld"
|
||||
# else
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# define PRIdGRUB_SSIZE "lld"
|
||||
# endif
|
||||
#else
|
||||
typedef grub_uint32_t grub_addr_t;
|
||||
|
@ -114,8 +116,13 @@ typedef grub_int32_t grub_ssize_t;
|
|||
# define PRIxGRUB_SIZE "x"
|
||||
# define PRIxGRUB_ADDR "x"
|
||||
# define PRIuGRUB_SIZE "u"
|
||||
# define PRIdGRUB_SSIZE "d"
|
||||
#endif
|
||||
|
||||
#define GRUB_UCHAR_MAX 0xFF
|
||||
#define GRUB_USHRT_MAX 65535
|
||||
#define GRUB_UINT_MAX 4294967295U
|
||||
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define GRUB_ULONG_MAX 18446744073709551615UL
|
||||
# define GRUB_LONG_MAX 9223372036854775807L
|
||||
|
@ -126,15 +133,9 @@ typedef grub_int32_t grub_ssize_t;
|
|||
# define GRUB_LONG_MIN (-2147483647L - 1)
|
||||
#endif
|
||||
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 4
|
||||
#define UINT_TO_PTR(x) ((void*)(grub_uint32_t)(x))
|
||||
#define PTR_TO_UINT64(x) ((grub_uint64_t)(grub_uint32_t)(x))
|
||||
#define PTR_TO_UINT32(x) ((grub_uint32_t)(x))
|
||||
#else
|
||||
#define UINT_TO_PTR(x) ((void*)(grub_uint64_t)(x))
|
||||
#define PTR_TO_UINT64(x) ((grub_uint64_t)(x))
|
||||
#define PTR_TO_UINT32(x) ((grub_uint32_t)(grub_uint64_t)(x))
|
||||
#endif
|
||||
typedef grub_uint64_t grub_properly_aligned_t;
|
||||
|
||||
#define GRUB_PROPERLY_ALIGNED_ARRAY(name, size) grub_properly_aligned_t name[((size) + sizeof (grub_properly_aligned_t) - 1) / sizeof (grub_properly_aligned_t)]
|
||||
|
||||
/* The type for representing a file offset. */
|
||||
typedef grub_uint64_t grub_off_t;
|
||||
|
@ -151,6 +152,18 @@ typedef grub_uint64_t grub_disk_addr_t;
|
|||
|
||||
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
|
||||
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
|
||||
#define grub_swap_bytes64_compile_time(x) \
|
||||
({ \
|
||||
grub_uint64_t _x = (x); \
|
||||
(grub_uint64_t) ((_x << 56) \
|
||||
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \
|
||||
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \
|
||||
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \
|
||||
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \
|
||||
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \
|
||||
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
|
||||
| (_x >> 56)); \
|
||||
})
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
|
||||
static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x)
|
||||
|
@ -199,6 +212,10 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
|
||||
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
|
||||
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
|
||||
# define grub_cpu_to_be16_compile_time(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_be32_compile_time(x) ((grub_uint32_t) (x))
|
||||
# define grub_cpu_to_be64_compile_time(x) ((grub_uint64_t) (x))
|
||||
# define grub_be_to_cpu64_compile_time(x) ((grub_uint64_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) grub_swap_bytes32_compile_time(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) grub_swap_bytes16_compile_time(x)
|
||||
#else /* ! WORDS_BIGENDIAN */
|
||||
|
@ -214,8 +231,66 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
|
||||
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
|
||||
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
|
||||
# define grub_cpu_to_be16_compile_time(x) grub_swap_bytes16_compile_time(x)
|
||||
# define grub_cpu_to_be32_compile_time(x) grub_swap_bytes32_compile_time(x)
|
||||
# define grub_cpu_to_be64_compile_time(x) grub_swap_bytes64_compile_time(x)
|
||||
# define grub_be_to_cpu64_compile_time(x) grub_swap_bytes64_compile_time(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x))
|
||||
|
||||
#endif /* ! WORDS_BIGENDIAN */
|
||||
|
||||
static inline grub_uint16_t grub_get_unaligned16 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint16_t
|
||||
{
|
||||
grub_uint16_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint16_t *dd
|
||||
= (const struct grub_unaligned_uint16_t *) ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val)
|
||||
{
|
||||
struct grub_unaligned_uint16_t
|
||||
{
|
||||
grub_uint16_t d;
|
||||
} __attribute__ ((packed));
|
||||
struct grub_unaligned_uint16_t *dd = (struct grub_unaligned_uint16_t *) ptr;
|
||||
dd->d = val;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t grub_get_unaligned32 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint32_t
|
||||
{
|
||||
grub_uint32_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint32_t *dd
|
||||
= (const struct grub_unaligned_uint32_t *) ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
static inline void grub_set_unaligned32 (void *ptr, grub_uint32_t val)
|
||||
{
|
||||
struct grub_unaligned_uint32_t
|
||||
{
|
||||
grub_uint32_t d;
|
||||
} __attribute__ ((packed));
|
||||
struct grub_unaligned_uint32_t *dd = (struct grub_unaligned_uint32_t *) ptr;
|
||||
dd->d = val;
|
||||
}
|
||||
|
||||
static inline grub_uint64_t grub_get_unaligned64 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint64_t
|
||||
{
|
||||
grub_uint64_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint64_t *dd
|
||||
= (const struct grub_unaligned_uint64_t *)ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* lvm.h - LVM support for GRUB utils. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2006,2007,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
|
||||
|
@ -20,7 +20,14 @@
|
|||
#ifndef GRUB_LVM_UTIL_HEADER
|
||||
#define GRUB_LVM_UTIL_HEADER 1
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#ifdef __linux__
|
||||
#define LVM_DEV_MAPPER_STRING "/dev/mapper/"
|
||||
#else
|
||||
#define LVM_DEV_MAPPER_STRING "/dev/linux_lvm/"
|
||||
#endif
|
||||
|
||||
int grub_util_lvm_isvolume (char *name);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
|||
|
||||
void sync (void);
|
||||
int fsync (int fno);
|
||||
void sleep(int s);
|
||||
|
||||
grub_int64_t grub_util_get_disk_size (char *name);
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -210,6 +210,66 @@ struct grub_video_palette_data
|
|||
grub_uint8_t a; /* Reserved bits value (0-255). */
|
||||
};
|
||||
|
||||
struct grub_video_edid_info
|
||||
{
|
||||
grub_uint8_t header[8];
|
||||
grub_uint16_t manufacturer_id;
|
||||
grub_uint16_t product_id;
|
||||
grub_uint32_t serial_number;
|
||||
grub_uint8_t week_of_manufacture;
|
||||
grub_uint8_t year_of_manufacture;
|
||||
grub_uint8_t version;
|
||||
grub_uint8_t revision;
|
||||
|
||||
grub_uint8_t video_input_definition;
|
||||
grub_uint8_t max_horizontal_image_size;
|
||||
grub_uint8_t max_vertical_image_size;
|
||||
grub_uint8_t display_gamma;
|
||||
grub_uint8_t feature_support;
|
||||
#define GRUB_VIDEO_EDID_FEATURE_PREFERRED_TIMING_MODE (1 << 1)
|
||||
|
||||
grub_uint8_t red_green_lo;
|
||||
grub_uint8_t blue_white_lo;
|
||||
grub_uint8_t red_x_hi;
|
||||
grub_uint8_t red_y_hi;
|
||||
grub_uint8_t green_x_hi;
|
||||
grub_uint8_t green_y_hi;
|
||||
grub_uint8_t blue_x_hi;
|
||||
grub_uint8_t blue_y_hi;
|
||||
grub_uint8_t white_x_hi;
|
||||
grub_uint8_t white_y_hi;
|
||||
|
||||
grub_uint8_t established_timings_1;
|
||||
grub_uint8_t established_timings_2;
|
||||
grub_uint8_t manufacturer_reserved_timings;
|
||||
|
||||
grub_uint16_t standard_timings[8];
|
||||
|
||||
struct {
|
||||
grub_uint16_t pixel_clock;
|
||||
/* Only valid if the pixel clock is non-null. */
|
||||
grub_uint8_t horizontal_active_lo;
|
||||
grub_uint8_t horizontal_blanking_lo;
|
||||
grub_uint8_t horizontal_hi;
|
||||
grub_uint8_t vertical_active_lo;
|
||||
grub_uint8_t vertical_blanking_lo;
|
||||
grub_uint8_t vertical_hi;
|
||||
grub_uint8_t horizontal_sync_offset_lo;
|
||||
grub_uint8_t horizontal_sync_pulse_width_lo;
|
||||
grub_uint8_t vertical_sync_lo;
|
||||
grub_uint8_t sync_hi;
|
||||
grub_uint8_t horizontal_image_size_lo;
|
||||
grub_uint8_t vertical_image_size_lo;
|
||||
grub_uint8_t image_size_hi;
|
||||
grub_uint8_t horizontal_border;
|
||||
grub_uint8_t vertical_border;
|
||||
grub_uint8_t flags;
|
||||
} detailed_timings[4];
|
||||
|
||||
grub_uint8_t extension_flag;
|
||||
grub_uint8_t checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
typedef enum grub_video_driver_id
|
||||
{
|
||||
GRUB_VIDEO_DRIVER_NONE,
|
||||
|
@ -222,6 +282,7 @@ typedef enum grub_video_driver_id
|
|||
GRUB_VIDEO_DRIVER_BOCHS,
|
||||
GRUB_VIDEO_DRIVER_SDL,
|
||||
GRUB_VIDEO_DRIVER_SIS315PRO,
|
||||
GRUB_VIDEO_DRIVER_RADEON_FULOONG2E,
|
||||
} grub_video_driver_id_t;
|
||||
|
||||
typedef enum grub_video_adapter_prio
|
||||
|
@ -312,6 +373,8 @@ struct grub_video_adapter
|
|||
|
||||
int (*iterate) (int (*hook) (const struct grub_video_mode_info *info));
|
||||
|
||||
grub_err_t (*get_edid) (struct grub_video_edid_info *edid_info);
|
||||
|
||||
void (*print_adapter_specific_info) (void);
|
||||
};
|
||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||
|
@ -424,6 +487,11 @@ grub_err_t EXPORT_FUNC (grub_video_set_active_render_target) (struct grub_video_
|
|||
|
||||
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_edid_checksum) (struct grub_video_edid_info *edid_info);
|
||||
grub_err_t EXPORT_FUNC (grub_video_edid_preferred_mode) (struct grub_video_edid_info *edid_info,
|
||||
unsigned int *width,
|
||||
unsigned int *height);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
|
||||
unsigned int modemask,
|
||||
unsigned int modevalue);
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
/* x86_64 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
|
|
|
@ -81,7 +81,7 @@ struct grub_xnu_extheader
|
|||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xnu_devtree_key *grub_xnu_create_key (struct grub_xnu_devtree_key **parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
extern struct grub_xnu_devtree_key *grub_xnu_devtree_root;
|
||||
|
||||
|
@ -89,18 +89,20 @@ void grub_xnu_free_devtree (struct grub_xnu_devtree_key *cur);
|
|||
|
||||
grub_err_t grub_xnu_writetree_toheap (grub_addr_t *target, grub_size_t *size);
|
||||
struct grub_xnu_devtree_key *grub_xnu_create_value (struct grub_xnu_devtree_key **parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
void grub_xnu_lock (void);
|
||||
void grub_xnu_unlock (void);
|
||||
grub_err_t grub_xnu_resume (char *imagename);
|
||||
grub_err_t grub_xnu_boot_resume (void);
|
||||
struct grub_xnu_devtree_key *grub_xnu_find_key (struct grub_xnu_devtree_key *parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
grub_err_t grub_xnu_align_heap (int align);
|
||||
grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,
|
||||
grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname,
|
||||
const char *osbundlerequired,
|
||||
int maxrecursion);
|
||||
grub_err_t grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
|
||||
grub_err_t grub_xnu_load_kext_from_dir (char *dirname,
|
||||
const char *osbundlerequired,
|
||||
int maxrecursion);
|
||||
grub_err_t grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target);
|
||||
grub_err_t grub_xnu_fill_devicetree (void);
|
||||
|
|
|
@ -88,6 +88,7 @@ typedef enum dmu_object_type {
|
|||
DMU_OT_SA_MASTER_NODE, /* ZAP */
|
||||
DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
|
||||
DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
|
||||
DMU_OT_DSL_KEYCHAIN = 54,
|
||||
DMU_OT_NUMTYPES
|
||||
} dmu_object_type_t;
|
||||
|
||||
|
|
|
@ -42,7 +42,9 @@ typedef struct dsl_dir_phys {
|
|||
grub_uint64_t dd_reserved;
|
||||
grub_uint64_t dd_props_zapobj;
|
||||
grub_uint64_t dd_deleg_zapobj; /* dataset permissions */
|
||||
grub_uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */
|
||||
grub_uint64_t unused[7];
|
||||
grub_uint64_t keychain;
|
||||
grub_uint64_t unused2[12];
|
||||
} dsl_dir_phys_t;
|
||||
|
||||
#endif /* _SYS_DSL_DIR_H */
|
||||
|
|
|
@ -29,6 +29,9 @@ typedef struct sa_hdr_phys {
|
|||
} sa_hdr_phys_t;
|
||||
|
||||
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
|
||||
#define SA_TYPE_OFFSET 0x0
|
||||
#define SA_SIZE_OFFSET 0x8
|
||||
#define SA_MTIME_OFFSET 0x38
|
||||
#define SA_SYMLINK_OFFSET 0xa0
|
||||
|
||||
#endif /* _SYS_SA_IMPL_H */
|
||||
|
|
|
@ -20,26 +20,24 @@
|
|||
#ifndef GRUB_ZFS_SPA_HEADER
|
||||
#define GRUB_ZFS_SPA_HEADER 1
|
||||
|
||||
typedef enum grub_zfs_endian
|
||||
{
|
||||
UNKNOWN_ENDIAN = -2,
|
||||
LITTLE_ENDIAN = -1,
|
||||
BIG_ENDIAN = 0
|
||||
} grub_zfs_endian_t;
|
||||
|
||||
#define grub_zfs_to_cpu16(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu16(x) \
|
||||
#define grub_zfs_to_cpu16(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_be_to_cpu16(x) \
|
||||
: grub_le_to_cpu16(x))
|
||||
#define grub_cpu_to_zfs16(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be16(x) \
|
||||
#define grub_cpu_to_zfs16(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_cpu_to_be16(x) \
|
||||
: grub_cpu_to_le16(x))
|
||||
|
||||
#define grub_zfs_to_cpu32(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu32(x) \
|
||||
#define grub_zfs_to_cpu32(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_be_to_cpu32(x) \
|
||||
: grub_le_to_cpu32(x))
|
||||
#define grub_cpu_to_zfs32(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be32(x) \
|
||||
#define grub_cpu_to_zfs32(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_cpu_to_be32(x) \
|
||||
: grub_cpu_to_le32(x))
|
||||
|
||||
#define grub_zfs_to_cpu64(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu64(x) \
|
||||
#define grub_zfs_to_cpu64(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) \
|
||||
? grub_be_to_cpu64(x) \
|
||||
: grub_le_to_cpu64(x))
|
||||
#define grub_cpu_to_zfs64(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be64(x) \
|
||||
#define grub_cpu_to_zfs64(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? grub_cpu_to_be64(x) \
|
||||
: grub_cpu_to_le64(x))
|
||||
|
||||
/*
|
||||
|
|
|
@ -69,7 +69,8 @@ typedef struct zap_leaf_phys {
|
|||
* with the ZAP_LEAF_CHUNK() macro.
|
||||
*/
|
||||
|
||||
grub_uint16_t l_hash[1];
|
||||
grub_uint16_t l_hash[0];
|
||||
grub_properly_aligned_t l_entries[0];
|
||||
} zap_leaf_phys_t;
|
||||
|
||||
typedef union zap_leaf_chunk {
|
||||
|
@ -90,7 +91,7 @@ typedef union zap_leaf_chunk {
|
|||
{
|
||||
grub_uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
|
||||
grub_uint64_t la_array64;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
grub_uint16_t la_next; /* next blk or CHAIN_END */
|
||||
} l_array;
|
||||
struct zap_leaf_free {
|
||||
|
|
|
@ -24,11 +24,19 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
typedef enum grub_zfs_endian
|
||||
{
|
||||
GRUB_ZFS_UNKNOWN_ENDIAN = -2,
|
||||
GRUB_ZFS_LITTLE_ENDIAN = -1,
|
||||
GRUB_ZFS_BIG_ENDIAN = 0
|
||||
} grub_zfs_endian_t;
|
||||
|
||||
/*
|
||||
* On-disk version number.
|
||||
*/
|
||||
#define SPA_VERSION 28ULL
|
||||
#define SPA_VERSION 33ULL
|
||||
|
||||
/*
|
||||
* The following are configuration names used in the nvlist describing a pool's
|
||||
|
@ -112,12 +120,34 @@ grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
|
|||
grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
|
||||
grub_uint64_t *mdnobj);
|
||||
|
||||
char *grub_zfs_nvlist_lookup_string (char *nvlist, char *name);
|
||||
char *grub_zfs_nvlist_lookup_nvlist (char *nvlist, char *name);
|
||||
int grub_zfs_nvlist_lookup_uint64 (char *nvlist, char *name,
|
||||
char *grub_zfs_nvlist_lookup_string (const char *nvlist, const char *name);
|
||||
char *grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name);
|
||||
int grub_zfs_nvlist_lookup_uint64 (const char *nvlist, const char *name,
|
||||
grub_uint64_t *out);
|
||||
char *grub_zfs_nvlist_lookup_nvlist_array (char *nvlist, char *name,
|
||||
char *grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist,
|
||||
const char *name,
|
||||
grub_size_t index);
|
||||
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (char *nvlist, char *name);
|
||||
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (const char *nvlist,
|
||||
const char *name);
|
||||
grub_err_t
|
||||
grub_zfs_add_key (grub_uint8_t *key_in,
|
||||
grub_size_t keylen,
|
||||
int passphrase);
|
||||
|
||||
extern grub_err_t (*grub_zfs_decrypt) (grub_crypto_cipher_handle_t cipher,
|
||||
grub_uint64_t algo,
|
||||
void *nonce,
|
||||
char *buf, grub_size_t size,
|
||||
const grub_uint32_t *expected_mac,
|
||||
grub_zfs_endian_t endian);
|
||||
|
||||
struct grub_zfs_key;
|
||||
|
||||
extern grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key,
|
||||
grub_size_t keysize,
|
||||
grub_uint64_t salt,
|
||||
grub_uint64_t algo);
|
||||
|
||||
|
||||
|
||||
#endif /* ! GRUB_ZFS_HEADER */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
typedef struct zio_eck {
|
||||
grub_uint64_t zec_magic; /* for validation, endianness */
|
||||
zio_cksum_t zec_cksum; /* 256-bit checksum */
|
||||
} zio_eck_t;
|
||||
} __attribute__ ((packed)) zio_eck_t;
|
||||
|
||||
/*
|
||||
* Gang block headers are self-checksumming and contain an array
|
||||
|
@ -65,6 +65,7 @@ enum zio_checksum {
|
|||
ZIO_CHECKSUM_FLETCHER_4,
|
||||
ZIO_CHECKSUM_SHA256,
|
||||
ZIO_CHECKSUM_ZILOG2,
|
||||
ZIO_CHECKSUM_SHA256_MAC,
|
||||
ZIO_CHECKSUM_FUNCTIONS
|
||||
};
|
||||
|
||||
|
@ -77,7 +78,16 @@ 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_ZLE,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
|
|
|
@ -23,22 +23,6 @@
|
|||
#ifndef _SYS_ZIO_CHECKSUM_H
|
||||
#define _SYS_ZIO_CHECKSUM_H
|
||||
|
||||
/*
|
||||
* Signature for checksum functions.
|
||||
*/
|
||||
typedef void zio_checksum_t(const void *data, grub_uint64_t size,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *zcp);
|
||||
|
||||
/*
|
||||
* Information about each checksum function.
|
||||
*/
|
||||
typedef struct zio_checksum_info {
|
||||
zio_checksum_t *ci_func; /* checksum function for each byteorder */
|
||||
int ci_correctable; /* number of correctable bits */
|
||||
int ci_eck; /* uses zio embedded checksum? */
|
||||
char *ci_name; /* descriptive name */
|
||||
} zio_checksum_info_t;
|
||||
|
||||
extern void zio_checksum_SHA256 (const void *, grub_uint64_t,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *);
|
||||
extern void fletcher_2 (const void *, grub_uint64_t, grub_zfs_endian_t endian,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue