/* legacy_bios.h - definitions of the legacy bios protocol */ /* * GRUB -- GRand Unified Bootloader * Copyright (C) 2007 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GRUB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GRUB. If not, see . */ /* The legacy bios protocol is not a part of the EFI spec, but defined in Intel's Compatibility Support Module Specification. */ #ifndef GRUB_EFI_LEGACY_BIOS_HEADER #define GRUB_EFI_LEGACY_BIOS_HEADER 1 #define GRUB_EFI_LEGACY_BIOS_GUID \ { 0xdb9a1e3d, 0x45cb, 0x4abb, \ { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d } \ } #define GRUB_EFI_BBS_FLOPPY 0x1 #define GRUB_EFI_BBS_HARDDISK 0x2 #define GRUB_EFI_BBS_CDROM 0x3 #define GRUB_EFI_BBS_PCMCIA 0x4 #define GRUB_EFI_BBS_USB 0x5 #define GRUB_EFI_BBS_EMBED_NETWORK 0x6 #define GRUB_EFI_BBS_BEV_DEVICE 0x80 struct grub_efi_ia32_register_set { void *regs; /* FIXME: must define this structure following specification */ }; typedef struct grub_efi_ia32_register_set grub_efi_ia32_register_set_t; struct grub_efi_atapi_identify { grub_uint16_t raw[256]; }; typedef struct grub_efi_atapi_identify grub_efi_atapi_identify_t; struct grub_efi_hdd_info { grub_uint16_t status; grub_uint32_t bus; grub_uint32_t device; grub_uint32_t function; grub_uint16_t command_base_address; grub_uint16_t control_base_address; grub_uint16_t bus_master_address; grub_uint8_t hdd_irq; grub_efi_atapi_identify_t identify_drive[2]; }; typedef struct grub_efi_hdd_info grub_efi_hdd_info_t; struct grub_efi_bbs_status_flags { grub_uint16_t old_position:4; grub_uint16_t reserved1:4; grub_uint16_t enabled:1; grub_uint16_t failed:1; grub_uint16_t media_present:2; grub_uint16_t reserved2:4; }; typedef struct grub_efi_bbs_status_flags grub_efi_bbs_status_flags_t; struct grub_efi_bbs_table { grub_uint16_t boot_priority; grub_uint32_t bus; grub_uint32_t device; grub_uint32_t function; grub_uint8_t class; grub_uint8_t sub_class; grub_uint16_t mfg_string_offset; grub_uint16_t mfg_string_segment; grub_uint16_t device_type; grub_efi_bbs_status_flags_t status_flags; grub_uint16_t boot_handler_offset; grub_uint16_t boot_handler_segment; grub_uint16_t desc_string_offset; grub_uint16_t desc_string_segment; grub_uint32_t init_per_reserved; grub_uint32_t additional_irq13_handler; grub_uint32_t additional_irq18_handler; grub_uint32_t additional_irq19_handler; grub_uint32_t additional_irq40_handler; grub_uint8_t assigned_drive_number; grub_uint32_t additional_irq41_handler; grub_uint32_t additional_irq46_handler; grub_uint32_t ibv1; grub_uint32_t ibv2; }; typedef struct grub_efi_bbs_table grub_efi_bbs_table_t; struct grub_efi_udc_attributes { grub_efi_uint8_t directory_service_validity:1; grub_efi_uint8_t rabca_used_flag:1; grub_efi_uint8_t execute_hdd_diagnostics_flag:1; grub_efi_uint8_t reserved:5; }; typedef struct grub_efi_udc_attributes grub_efi_udc_attributes_t; struct grub_efi_legacy_bios_protocol { grub_efi_boolean_t (*int86) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uint8_t bios_int, grub_efi_ia32_register_set_t *regs); grub_efi_boolean_t (*far_call86) (struct grub_efi_legacy_bios_protocol *this, grub_uint16_t segment, grub_uint16_t offset, grub_efi_ia32_register_set_t *regs, void *stack, grub_efi_uintn_t stack_size); grub_efi_status_t (*check_pci_rom) (struct grub_efi_legacy_bios_protocol *this, grub_efi_handle_t pci_handle, void **rom_image, grub_efi_uintn_t *rom_size, grub_efi_uintn_t *flags); grub_efi_status_t (*install_pci_rom) (struct grub_efi_legacy_bios_protocol *this, grub_efi_handle_t pci_handle, void **rom_image, grub_efi_uintn_t *flags, grub_efi_uint8_t *disk_start, grub_efi_uint8_t *disk_end, void **rom_shadow_address, grub_efi_uint32_t *shadowed_rom_size); grub_efi_status_t (*legacy_boot) (struct grub_efi_legacy_bios_protocol *this, grub_efi_bios_device_path_t *boot_option, grub_efi_uint32_t load_options_size, void *load_options); grub_efi_status_t (*update_keyboard_led_status) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uint8_t leds); grub_efi_status_t (*get_bbs_info) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uint16_t *hdd_count, grub_efi_hdd_info_t **hdd_info, grub_efi_uint16_t *bbs_count, grub_efi_bbs_table_t **bbs_table); grub_efi_status_t (*shadow_all_legacy_oproms) (struct grub_efi_legacy_bios_protocol *this); grub_efi_status_t (*prepare_to_boot_efi) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uint16_t *bbs_count, grub_efi_bbs_table_t **bbs_table); grub_efi_status_t (*get_legacy_region) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uintn_t legacy_memory_size, grub_efi_uintn_t region, grub_efi_uintn_t alignment, void **legacy_memory_address); grub_efi_status_t (*copy_legacy_region) (struct grub_efi_legacy_bios_protocol *this, grub_efi_uintn_t legacy_memory_size, void *legacy_memory_address, void *legacy_memory_source_address); grub_efi_status_t (*boot_unconventional_device) (struct grub_efi_legacy_bios_protocol *this, grub_efi_udc_attributes_t attributes, grub_efi_uintn_t bbs_entry, void *beer_data, void *service_area_data); }; typedef struct grub_efi_legacy_bios_protocol grub_efi_legacy_bios_protocol_t; #endif /* ! GRUB_EFI_LEGACY_BIOS_HEADER */