/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. * * VAS_EBOOT 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. * * VAS_EBOOT 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 VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_EFI_PCI_HEADER #define VAS_EBOOT_EFI_PCI_HEADER 1 #include #define VAS_EBOOT_EFI_PCI_IO_GUID \ { 0x4cf5b200, 0x68b8, 0x4ca5, { 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a }} #define VAS_EBOOT_EFI_PCI_ROOT_IO_GUID \ { 0x2F707EBB, 0x4A1A, 0x11d4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} typedef enum { VAS_EBOOT_EFI_PCI_IO_WIDTH_UINT8, VAS_EBOOT_EFI_PCI_IO_WIDTH_UINT16, VAS_EBOOT_EFI_PCI_IO_WIDTH_UINT32, VAS_EBOOT_EFI_PCI_IO_WIDTH_UINT64, VAS_EBOOT_EFI_PCI_IO_WIDTH_FIFO_UINT8, VAS_EBOOT_EFI_PCI_IO_WIDTH_FIFO_UINT16, VAS_EBOOT_EFI_PCI_IO_WIDTH_FIFO_UINT32, VAS_EBOOT_EFI_PCI_IO_WIDTH_FIFO_UINT64, VAS_EBOOT_EFI_PCI_IO_WIDTH_FILL_UINT8, VAS_EBOOT_EFI_PCI_IO_WIDTH_FILL_UINT16, VAS_EBOOT_EFI_PCI_IO_WIDTH_FILL_UINT32, VAS_EBOOT_EFI_PCI_IO_WIDTH_FILL_UINT64, VAS_EBOOT_EFI_PCI_IO_WIDTH_MAXIMUM, } VasEBoot_efi_pci_io_width_t; struct VasEBoot_efi_pci_io; typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_mem_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint8_t bar_index, VasEBoot_efi_uint64_t offset, VasEBoot_efi_uintn_t count, void *buffer); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_config_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint32_t offset, VasEBoot_efi_uintn_t count, void *buffer); typedef struct { VasEBoot_efi_pci_io_mem_t read; VasEBoot_efi_pci_io_mem_t write; } VasEBoot_efi_pci_io_access_t; typedef struct { VasEBoot_efi_pci_io_config_t read; VasEBoot_efi_pci_io_config_t write; } VasEBoot_efi_pci_io_config_access_t; typedef enum { VAS_EBOOT_EFI_PCI_IO_OPERATION_BUS_MASTER_READ, VAS_EBOOT_EFI_PCI_IO_OPERATION_BUS_MASTER_WRITE, VAS_EBOOT_EFI_PCI_IO_OPERATION_BUS_MASTER_COMMON_BUFFER, VAS_EBOOT_EFI_PCI_IO_OPERATION_BUS_MASTER_MAXIMUM } VasEBoot_efi_pci_io_operation_t; #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_IO 0x0100 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 #define VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 typedef enum { VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_GET, VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_SET, VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_ENABLE, VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_DISABLE, VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_SUPPORTED, VAS_EBOOT_EFI_PCI_IO_ATTRIBUTE_OPERATION_MAXIMUM } VasEBoot_efi_pci_io_attribute_operation_t; typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_poll_io_mem_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint8_t bar_ndex, VasEBoot_efi_uint64_t offset, VasEBoot_efi_uint64_t mask, VasEBoot_efi_uint64_t value, VasEBoot_efi_uint64_t delay, VasEBoot_efi_uint64_t *result); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_copy_mem_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint8_t dest_bar_index, VasEBoot_efi_uint64_t dest_offset, VasEBoot_efi_uint8_t src_bar_index, VasEBoot_efi_uint64_t src_offset, VasEBoot_efi_uintn_t count); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_map_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_operation_t operation, void *host_address, VasEBoot_efi_uintn_t *number_of_bytes, VasEBoot_efi_uint64_t *device_address, void **mapping); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_unmap_t) (struct VasEBoot_efi_pci_io *this, void *mapping); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_allocate_buffer_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_allocate_type_t type, VasEBoot_efi_memory_type_t memory_type, VasEBoot_efi_uintn_t pages, void **host_address, VasEBoot_efi_uint64_t attributes); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_free_buffer_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_allocate_type_t type, VasEBoot_efi_memory_type_t memory_type, VasEBoot_efi_uintn_t pages, void **host_address, VasEBoot_efi_uint64_t attributes); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_flush_t) (struct VasEBoot_efi_pci_io *this); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_get_location_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_uintn_t *segment_number, VasEBoot_efi_uintn_t *bus_number, VasEBoot_efi_uintn_t *device_number, VasEBoot_efi_uintn_t *function_number); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_attributes_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_pci_io_attribute_operation_t operation, VasEBoot_efi_uint64_t attributes, VasEBoot_efi_uint64_t *result); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_get_bar_attributes_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_uint8_t bar_index, VasEBoot_efi_uint64_t *supports, void **resources); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_io_set_bar_attributes_t) (struct VasEBoot_efi_pci_io *this, VasEBoot_efi_uint64_t attributes, VasEBoot_efi_uint8_t bar_index, VasEBoot_efi_uint64_t *offset, VasEBoot_efi_uint64_t *length); struct VasEBoot_efi_pci_io { VasEBoot_efi_pci_io_poll_io_mem_t poll_mem; VasEBoot_efi_pci_io_poll_io_mem_t poll_io; VasEBoot_efi_pci_io_access_t mem; VasEBoot_efi_pci_io_access_t io; VasEBoot_efi_pci_io_config_access_t pci; VasEBoot_efi_pci_io_copy_mem_t copy_mem; VasEBoot_efi_pci_io_map_t map; VasEBoot_efi_pci_io_unmap_t unmap; VasEBoot_efi_pci_io_allocate_buffer_t allocate_buffer; VasEBoot_efi_pci_io_free_buffer_t free_buffer; VasEBoot_efi_pci_io_flush_t flush; VasEBoot_efi_pci_io_get_location_t get_location; VasEBoot_efi_pci_io_attributes_t attributes; VasEBoot_efi_pci_io_get_bar_attributes_t get_bar_attributes; VasEBoot_efi_pci_io_set_bar_attributes_t set_bar_attributes; VasEBoot_efi_uint64_t rom_size; void *rom_image; }; typedef struct VasEBoot_efi_pci_io VasEBoot_efi_pci_io_t; struct VasEBoot_efi_pci_root_io; typedef struct { VasEBoot_efi_status_t(*read) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint64_t address, VasEBoot_efi_uintn_t count, void *buffer); VasEBoot_efi_status_t(*write) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint64_t address, VasEBoot_efi_uintn_t count, void *buffer); } VasEBoot_efi_pci_root_io_access_t; typedef enum { VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_READ, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_WRITE, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_COMMON_BUFFER, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_READ_64, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_WRITE_64, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_COMMON_BUFFER_64, VAS_EBOOT_EFI_PCI_ROOT_IO_OPERATION_BUS_MASTER_MAXIMUM } VasEBoot_efi_pci_root_io_operation_t; typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_poll_io_mem_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint64_t address, VasEBoot_efi_uint64_t mask, VasEBoot_efi_uint64_t value, VasEBoot_efi_uint64_t delay, VasEBoot_efi_uint64_t *result); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_copy_mem_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_pci_io_width_t width, VasEBoot_efi_uint64_t dest_offset, VasEBoot_efi_uint64_t src_offset, VasEBoot_efi_uintn_t count); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_map_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_pci_root_io_operation_t operation, void *host_address, VasEBoot_efi_uintn_t *number_of_bytes, VasEBoot_efi_uint64_t *device_address, void **mapping); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_unmap_t) (struct VasEBoot_efi_pci_root_io *this, void *mapping); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_allocate_buffer_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_allocate_type_t type, VasEBoot_efi_memory_type_t memory_type, VasEBoot_efi_uintn_t pages, void **host_address, VasEBoot_efi_uint64_t attributes); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_free_buffer_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_uintn_t pages, void **host_address); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_flush_t) (struct VasEBoot_efi_pci_root_io *this); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_get_attributes_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_uint64_t *supports, void **resources); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_set_attributes_t) (struct VasEBoot_efi_pci_root_io *this, VasEBoot_efi_uint64_t attributes, VasEBoot_efi_uint64_t *offset, VasEBoot_efi_uint64_t *length); typedef VasEBoot_efi_status_t (*VasEBoot_efi_pci_root_io_configuration_t) (struct VasEBoot_efi_pci_root_io *this, void **resources); struct VasEBoot_efi_pci_root_io { VasEBoot_efi_handle_t parent; VasEBoot_efi_pci_root_io_poll_io_mem_t poll_mem; VasEBoot_efi_pci_root_io_poll_io_mem_t poll_io; VasEBoot_efi_pci_root_io_access_t mem; VasEBoot_efi_pci_root_io_access_t io; VasEBoot_efi_pci_root_io_access_t pci; VasEBoot_efi_pci_root_io_copy_mem_t copy_mem; VasEBoot_efi_pci_root_io_map_t map; VasEBoot_efi_pci_root_io_unmap_t unmap; VasEBoot_efi_pci_root_io_allocate_buffer_t allocate_buffer; VasEBoot_efi_pci_root_io_free_buffer_t free_buffer; VasEBoot_efi_pci_root_io_flush_t flush; VasEBoot_efi_pci_root_io_get_attributes_t get_attributes; VasEBoot_efi_pci_root_io_set_attributes_t set_attributes; VasEBoot_efi_pci_root_io_configuration_t configuration; }; typedef struct VasEBoot_efi_pci_root_io VasEBoot_efi_pci_root_io_t; #endif /* !VAS_EBOOT_EFI_PCI_HEADER */