2006-04-23 Yoshinori K. Okuji <okuji@enbug.org>

Use grub_abort instead of grub_stop, and grub_exit must be
        define in each architecture now. Also, this change adds support
        for EFI disks.

        * util/i386/pc/grub-probefs.c: Include grub/term.h.
        (grub_getkey): New function.
        (grub_term_get_current): Likewise.

        * util/i386/pc/grub-setup.c: Include grub/term.h.
        (grub_getkey): New function.
        (grub_term_get_current): Likewise.

        * util/misc.c (grub_stop): Renamed to ...
        (grub_exit): ... this.

        * kern/powerpc/ieee1275/init.c (abort): Renamed to ...
        (grub_exit): ... this.
        (grub_machine_init): Use grub_abort instead of abort.
        (grub_stop): Removed.

        * kern/powerpc/ieee1275/cmain.c (cmain): Use grub_abort instead of
        abort.

        * kern/i386/pc/startup.S (grub_exit): New function.
        (cold_reboot): New label.

        * kern/efi/init.c: Include grub/efi/disk.h and grub/env.h.
        (grub_efi_init): Call grub_efidisk_init.
        (grub_efi_fini): Call grub_efidisk_fini.

        * kern/efi/efi.c: Include grub/mm.h.
        (grub_efi_console_control_guid): Renamed to ...
        (console_control_guid): ... this.
        (grub_efi_loaded_image_guid): Renamed to ...
        (loaded_image_guid): ... this.
        (grub_efi_locate_handle): New function.
        (grub_efi_open_protocol): Likewise.
        (grub_efi_set_text_mode): Use CONSOLE_CONTROL_GUID instead of
        GRUB_EFI_CONSOLE_CONTROL_GUID.
        (grub_efi_exit): Removed.
        (grub_stop): Likewise.
        (grub_efi_get_loaded_image): Use grub_efi_open_protocol.
        (grub_exit): New function.
        (grub_print_device_path): Likewise.

        * kern/rescue.c (grub_rescue_cmd_exit): New function.
        (grub_enter_rescue_mode): Register "exit".

        * kern/misc.c (grub_real_dprintf): A cosmetic change.
        (grub_abort): New function.

        * kern/err.c (grub_fatal): Use grub_abort instead of grub_stop.

        * include/grub/sparc64/ieee1275/kernel.h (abort): Removed.

        * include/grub/powerpc/ieee1275/kernel.h (abort): Removed.

        * include/grub/efi/efi.h (grub_efi_exit): Removed.
        (grub_print_device_path): New prototype.
        (grub_efi_locate_handle): Likewise.
        (grub_efi_open_protocol): Likewise.

        * include/grub/efi/disk.h (grub_efidisk_fini): New file.
        * disk/efi/efidisk.c: Likewise.

        * DISTLIST: Added disk/efi/efidisk.c and include/grub/efi/disk.h.

        * include/grub/efi/console_control.h
        (GRUB_EFI_CONSOLE_CONTROL_GUID): Use an array for the last 8 bytes.

        * include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): Specify the
        last 8 bytes as an array.
        (GRUB_EFI_DISK_IO_GUID): New macro.
        (GRUB_EFI_BLOCK_IO_GUID): Likewise.
        (GRUB_EFI_DEVICE_PATH_GUID): Likewise.
        (grub_efi_ipv6_address_t): Change the type to grub_uint16_t from
        grub_uint8_t.
        (struct grub_efi_guid): Use an array to specify the last 8 bytes.
        (struct grub_efi_device_path): Rename the member "sub_type" to
        "subtype".
        (GRUB_EFI_DEVICE_PATH_TYPE): New macro.
        (GRUB_EFI_DEVICE_PATH_SUBTYPE): Likewise.
        (GRUB_EFI_DEVICE_PATH_LENGTH): Likewise.
        (GRUB_EFI_END_DEVICE_PATH_TYPE): Likewise.
        (GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE): Likewise.
        (GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE): Likewise.
        (GRUB_EFI_END_ENTIRE_DEVICE_PATH): Likewise.
        (GRUB_EFI_NEXT_DEVICE_PATH): Likewise.
        (GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE): Likewise.
        (GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE): Likewise.
        (struct grub_efi_pci_device_path): New structure.
        (grub_efi_pci_device_path_t): New type.
        (GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_pccard_device_path): New structure.
        (grub_efi_pccard_device_path_t): New type.
        (GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_memory_mapped_device_path): New structure.
        (grub_efi_memory_mapped_device_path_t): New type.
        (GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_vendor_device_path): New structure.
        (grub_efi_vendor_device_path_t): New type.
        (GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_controller_device_path): New structure.
        (grub_efi_controller_device_path_t): New type.
        (GRUB_EFI_ACPI_DEVICE_PATH_TYPE): New macro.
        (GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE): Likewise.
        (struct grub_efi_acpi_device_path): New structure.
        (grub_efi_acpi_device_path_t): New type.
        (GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_expanded_acpi_device_path): New structure.
        (grub_efi_expanded_acpi_device_path_t): New type.
        (GRUB_EFI_EXPANDED_ACPI_HIDSTR): New macro.
        (GRUB_EFI_EXPANDED_ACPI_UIDSTR): Likewise.
        (GRUB_EFI_EXPANDED_ACPI_CIDSTR): Likewise.
        (GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE): Likewise.
        (GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE): Likewise.
        (struct grub_efi_atapi_device_path): New structure.
        (grub_efi_atapi_device_path_t): New type.
        (GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_fibre_channel_device_path): New structure.
        (grub_efi_fibre_channel_device_path_t): New type.
        (GRUB_EFI_1394_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_1394_device_path): New structure.
        (grub_efi_1394_device_path_t): New type.
        (GRUB_EFI_USB_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_usb_device_path): New structure.
        (grub_efi_usb_device_path_t): New type.
        (GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_usb_class_device_path): New structure.
        (grub_efi_usb_class_device_path_t): New type.
        (GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_i2o_device_path): New structure.
        (grub_efi_i2o_device_path_t): New type.
        (GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_mac_address_device_path): New structure.
        (grub_efi_mac_address_device_path_t): New type.
        (GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_ipv4_device_path): New structure.
        (grub_efi_ipv4_device_path_t): New type.
        (GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_ipv6_device_path): New structure.
        (grub_efi_ipv6_device_path_t): New type.
        (GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_infiniband_device_path): New structure.
        (grub_efi_infiniband_device_path_t): New type.
        (GRUB_EFI_UART_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_uart_device_path): New structure.
        (grub_efi_uart_device_path_t): New type.
        (GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_vendor_messaging_device_path): New structure.
        (grub_efi_vendor_messaging_device_path_t): New type.
        (GRUB_EFI_MEDIA_DEVICE_PATH_TYPE): New macro.
        (GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE): Likewise.
        (struct grub_efi_hard_drive_device_path): New structure.
        (grub_efi_hard_drive_device_path_t): New type.
        (GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_cdrom_device_path): New structure.
        (grub_efi_cdrom_device_path_t): New type.
        (GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_vendor_media_device_path): New structure.
        (grub_efi_vendor_media_device_path_t): New type.
        (GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_file_path_device_path): New structure.
        (grub_efi_file_path_device_path_t): New type.
        (GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE): New macro.
        (struct grub_efi_protocol_device_path): New structure.
        (grub_efi_protocol_device_path_t): New type.
        (GRUB_EFI_BIOS_DEVICE_PATH_TYPE): New macro.
        (GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE): Likewise.
        (struct grub_efi_bios_device_path): New structure.
        (grub_efi_bios_device_path_t): New type.
        (struct grub_efi_disk_io): New structure.
        (grub_efi_disk_io_t): New type.
        (struct grub_efi_block_io_media): New structure.
        (grub_efi_block_io_media_t): New type.
        (struct grub_efi_block_io): New structure.
        (grub_efi_block_io_t): New type.

        * include/grub/misc.h (grub_stop): Removed.
        (grub_exit): New prototype.
        (grub_abort): Likewise.

        * include/grub/disk.h (enum grub_disk_dev_id): Added
        GRUB_DISK_DEVICE_EFIDISK_ID.

        * conf/i386-efi.rmk (kernel_mod_SOURCES): Added
        disk/efi/efidisk.c.
        (kernel_syms.lst): Remove the target if an error occurs.
This commit is contained in:
okuji 2006-04-23 13:37:36 +00:00
parent 49986a9f99
commit 9cacaa174c
24 changed files with 1853 additions and 85 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2004,2005,2006 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
@ -31,7 +31,8 @@ enum grub_disk_dev_id
{
GRUB_DISK_DEVICE_BIOSDISK_ID,
GRUB_DISK_DEVICE_OFDISK_ID,
GRUB_DISK_DEVICE_LOOPBACK_ID
GRUB_DISK_DEVICE_LOOPBACK_ID,
GRUB_DISK_DEVICE_EFIDISK_ID
};
struct grub_disk;

View file

@ -70,7 +70,24 @@
#define GRUB_EFI_OPTIONAL_PTR 0x00000001
#define GRUB_EFI_LOADED_IMAGE_GUID \
{ 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0x5b1b31a1, 0x9562, 0x11d2, \
{ 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
#define GRUB_EFI_DISK_IO_GUID \
{ 0xce345171, 0xba0b, 0x11d2, \
{ 0x8e, 0x4f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
#define GRUB_EFI_BLOCK_IO_GUID \
{ 0x964e5b21, 0x6459, 0x11d2, \
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
#define GRUB_EFI_DEVICE_PATH_GUID \
{ 0x09576e91, 0x6d3f, 0x11d2, \
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
/* Enumerations. */
enum grub_efi_timer_delay
@ -195,7 +212,7 @@ typedef grub_efi_uint64_t grub_efi_lba_t;
typedef grub_efi_uintn_t grub_efi_tpl_t;
typedef grub_uint8_t grub_efi_mac_address_t[32];
typedef grub_uint8_t grub_efi_ipv4_address_t[4];
typedef grub_uint8_t grub_efi_ipv6_address_t[8];
typedef grub_uint16_t grub_efi_ipv6_address_t[8];
typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4)));
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@ -205,14 +222,7 @@ struct grub_efi_guid
grub_uint32_t data1;
grub_uint16_t data2;
grub_uint16_t data3;
grub_uint8_t data4;
grub_uint8_t data5;
grub_uint8_t data6;
grub_uint8_t data7;
grub_uint8_t data8;
grub_uint8_t data9;
grub_uint8_t data10;
grub_uint8_t data11;
grub_uint8_t data4[8];
} __attribute__ ((aligned(8)));
typedef struct grub_efi_guid grub_efi_guid_t;
@ -229,10 +239,11 @@ struct grub_efi_memory_descriptor
};
typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t;
/* Device Path definitions. */
struct grub_efi_device_path
{
grub_efi_uint8_t type;
grub_efi_uint8_t sub_type;
grub_efi_uint8_t subtype;
grub_efi_uint8_t length[2];
};
typedef struct grub_efi_device_path grub_efi_device_path_t;
@ -240,6 +251,333 @@ typedef struct grub_efi_device_path grub_efi_device_path_t;
It seems to be identical to EFI_DEVICE_PATH. */
typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
#define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f)
#define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype)
#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) \
((dp)->length[0] | ((grub_efi_uint16_t) ((dp)->length[1]) << 8))
/* The End of Device Path nodes. */
#define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f)
#define GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
#define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01
#define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \
(GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
== GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))
#define GRUB_EFI_NEXT_DEVICE_PATH(dp) \
((grub_efi_device_path_t *) ((char *) (dp) \
+ GRUB_EFI_DEVICE_PATH_LENGTH (dp)))
/* Hardware Device Path. */
#define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1
#define GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE 1
struct grub_efi_pci_device_path
{
grub_efi_device_path_t header;
grub_efi_uint8_t function;
grub_efi_uint8_t device;
};
typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t;
#define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
struct grub_efi_pccard_device_path
{
grub_efi_device_path_t header;
grub_efi_uint8_t function;
};
typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
#define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
struct grub_efi_memory_mapped_device_path
{
grub_efi_device_path_t header;
grub_efi_memory_type_t memory_type;
grub_efi_physical_address_t start_address;
grub_efi_physical_address_t end_address;
};
typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t;
#define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
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];
};
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
#define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
struct grub_efi_controller_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t controller_number;
};
typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t;
/* ACPI Device Path. */
#define GRUB_EFI_ACPI_DEVICE_PATH_TYPE 2
#define GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE 1
struct grub_efi_acpi_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t hid;
grub_efi_uint32_t uid;
};
typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t;
#define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
struct grub_efi_expanded_acpi_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t hid;
grub_efi_uint32_t uid;
grub_efi_uint32_t cid;
char hidstr[1];
};
typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t;
#define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
(((grub_efi_expanded_acpi_device_path_t *) dp)->hidstr)
#define GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \
(GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
+ grub_strlen (GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp)) + 1)
#define GRUB_EFI_EXPANDED_ACPI_CIDSTR(dp) \
(GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp) \
+ grub_strlen (GRUB_EFI_EXPANDED_ACPI_UIDSTR(dp)) + 1)
/* Messaging Device Path. */
#define GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE 3
#define GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE 1
struct grub_efi_atapi_device_path
{
grub_efi_device_path_t header;
grub_efi_uint8_t primary_secondary;
grub_efi_uint8_t slave_master;
grub_efi_uint16_t lun;
};
typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t;
#define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
struct grub_efi_scsi_device_path
{
grub_efi_device_path_t header;
grub_efi_uint16_t pun;
grub_efi_uint16_t lun;
};
typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t;
#define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
struct grub_efi_fibre_channel_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t reserved;
grub_efi_uint64_t wwn;
grub_efi_uint64_t lun;
};
typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t;
#define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
struct grub_efi_1394_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t reserved;
grub_efi_uint64_t guid;
};
typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t;
#define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
struct grub_efi_usb_device_path
{
grub_efi_device_path_t header;
grub_efi_uint8_t parent_port_number;
grub_efi_uint8_t interface;
};
typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t;
#define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
struct grub_efi_usb_class_device_path
{
grub_efi_device_path_t header;
grub_efi_uint16_t vendor_id;
grub_efi_uint16_t product_id;
grub_efi_uint8_t device_class;
grub_efi_uint8_t device_subclass;
grub_efi_uint8_t device_protocol;
};
typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t;
#define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
struct grub_efi_i2o_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t tid;
};
typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t;
#define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
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;
};
typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t;
#define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
struct grub_efi_ipv4_device_path
{
grub_efi_device_path_t header;
grub_efi_ipv4_address_t local_ip_address;
grub_efi_ipv4_address_t remote_ip_address;
grub_efi_uint16_t local_port;
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
};
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
#define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
struct grub_efi_ipv6_device_path
{
grub_efi_device_path_t header;
grub_efi_ipv6_address_t local_ip_address;
grub_efi_ipv6_address_t remote_ip_address;
grub_efi_uint16_t local_port;
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
};
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
#define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
struct grub_efi_infiniband_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t resource_flags;
grub_efi_uint8_t port_gid[16];
grub_efi_uint64_t remote_id;
grub_efi_uint64_t target_port_id;
grub_efi_uint64_t device_id;
};
typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t;
#define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
struct grub_efi_uart_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t reserved;
grub_efi_uint64_t baud_rate;
grub_efi_uint8_t data_bits;
grub_efi_uint8_t parity;
grub_efi_uint8_t stop_bits;
};
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
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];
};
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
/* Media Device Path. */
#define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE 4
#define GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE 1
struct grub_efi_hard_drive_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t partition_number;
grub_efi_lba_t partition_start;
grub_efi_lba_t partition_size;
grub_efi_uint8_t partition_signature[8];
grub_efi_uint8_t mbr_type;
grub_efi_uint8_t signature_type;
};
typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t;
#define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
struct grub_efi_cdrom_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t boot_entry;
grub_efi_lba_t partition_start;
grub_efi_lba_t partition_size;
};
typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
#define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
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];
};
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
#define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
struct grub_efi_file_path_device_path
{
grub_efi_device_path_t header;
grub_efi_char16_t path_name[0];
};
typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
#define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
struct grub_efi_protocol_device_path
{
grub_efi_device_path_t header;
grub_efi_guid_t guid;
};
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
/* BIOS Boot Specification Device Path. */
#define GRUB_EFI_BIOS_DEVICE_PATH_TYPE 5
#define GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE 1
struct grub_efi_bios_device_path
{
grub_efi_device_path_t header;
grub_efi_uint16_t device_type;
grub_efi_uint16_t status_flags;
char description[0];
};
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
struct grub_efi_open_protocol_information_entry
{
grub_efi_handle_t agent_handle;
@ -706,4 +1044,56 @@ struct grub_efi_loaded_image
};
typedef struct grub_efi_loaded_image grub_efi_loaded_image_t;
struct grub_efi_disk_io
{
grub_efi_uint64_t revision;
grub_efi_status_t (*read) (struct grub_efi_disk_io *this,
grub_efi_uint32_t media_id,
grub_efi_uint64_t offset,
grub_efi_uintn_t buffer_size,
void *buffer);
grub_efi_status_t (*write) (struct grub_efi_disk_io *this,
grub_efi_uint32_t media_id,
grub_efi_uint64_t offset,
grub_efi_uintn_t buffer_size,
void *buffer);
};
typedef struct grub_efi_disk_io grub_efi_disk_io_t;
struct grub_efi_block_io_media
{
grub_efi_uint32_t media_id;
grub_efi_boolean_t removable_media;
grub_efi_boolean_t media_present;
grub_efi_boolean_t logical_partition;
grub_efi_boolean_t read_only;
grub_efi_boolean_t write_caching;
grub_efi_uint8_t pad[3];
grub_efi_uint32_t block_size;
grub_efi_uint32_t io_align;
grub_efi_uint8_t pad2[4];
grub_efi_lba_t last_block;
};
typedef struct grub_efi_block_io_media grub_efi_block_io_media_t;
struct grub_efi_block_io
{
grub_efi_uint64_t revision;
grub_efi_block_io_media_t *media;
grub_efi_status_t (*reset) (struct grub_efi_block_io *this,
grub_efi_boolean_t extended_verification);
grub_efi_status_t (*read_blocks) (struct grub_efi_block_io *this,
grub_efi_uint32_t media_id,
grub_efi_lba_t lba,
grub_efi_uintn_t buffer_size,
void *buffer);
grub_efi_status_t (*write_blocks) (struct grub_efi_block_io *this,
grub_efi_uint32_t media_id,
grub_efi_lba_t lba,
grub_efi_uintn_t buffer_size,
void *buffer);
grub_efi_status_t (*flush_blocks) (struct grub_efi_block_io *this);
};
typedef struct grub_efi_block_io grub_efi_block_io_t;
#endif /* ! GRUB_EFI_API_HEADER */

View file

@ -25,7 +25,9 @@
#define GRUB_EFI_CONSOLE_CONTROL_HEADER 1
#define GRUB_EFI_CONSOLE_CONTROL_GUID \
{ 0xf42f7782, 0x12e, 0x4c12, 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 }
{ 0xf42f7782, 0x12e, 0x4c12, \
{ 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } \
}
enum grub_efi_screen_mode
{

26
include/grub/efi/disk.h Normal file
View file

@ -0,0 +1,26 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006 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 2 of the License, or
* (at your option) any later version.
*
* This program 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef GRUB_EFI_DISK_HEADER
#define GRUB_EFI_DISK_HEADER 1
void grub_efidisk_init (void);
void grub_efidisk_fini (void);
#endif /* ! GRUB_EFI_DISK_HEADER */

View file

@ -28,19 +28,29 @@
/* Functions. */
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *registration);
grub_efi_handle_t *
EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type,
grub_efi_guid_t *protocol,
void *search_key,
grub_efi_uintn_t *num_handles);
void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
grub_efi_guid_t *protocol,
grub_efi_uint32_t attributes);
int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
void EXPORT_FUNC(grub_efi_exit) (void) __attribute__((noreturn));
void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
void *EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
void *
EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
int EXPORT_FUNC(grub_efi_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);
int
EXPORT_FUNC(grub_efi_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_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (void);
void EXPORT_FUNC(grub_print_device_path) (grub_efi_device_path_t *dp);
void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);

View file

@ -68,7 +68,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
grub_uint16_t *src,
grub_size_t size);
@ -81,9 +82,9 @@ static inline unsigned int
grub_abs (int x)
{
if (x < 0)
return (unsigned int)(-x);
return (unsigned int) (-x);
else
return (unsigned int)x;
return (unsigned int) x;
}
#endif /* ! GRUB_MISC_HEADER */

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005 Free Software Foundation, Inc.
* Copyright (C) 2005,2006 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,6 @@
#include <grub/symbol.h>
void EXPORT_FUNC (abort) (void);
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);

View file

@ -22,7 +22,6 @@
#include <grub/symbol.h>
void EXPORT_FUNC (abort) (void);
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);