/* * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Axel Dörfler, axeld@pinc-software.de * Alexander von Gluck IV, kallisti5@unixzen.com */ #ifndef RADEON_HD_H #define RADEON_HD_H #include "lock.h" #include "rhd_regs.h" #include "r600_reg.h" #include "r800_reg.h" #include #include #include #include #define VENDOR_ID_ATI 0x1002 #define RADEON_R600 0x0600 #define RADEON_R700 0x0700 #define RADEON_R800 0x0800 #define RADEON_VBIOS_SIZE 0x10000 #define DEVICE_NAME "radeon_hd" #define RADEON_ACCELERANT_NAME "radeon_hd.accelerant" // Used to collect EDID from boot loader #define EDID_BOOT_INFO "vesa_edid/v1" #define MODES_BOOT_INFO "vesa_modes/v1" #define RHD_POWER_ON 0 #define RHD_POWER_RESET 1 /* off temporarily */ #define RHD_POWER_SHUTDOWN 2 /* long term shutdown */ #define RHD_POWER_UNKNOWN 3 /* initial state */ // info about PLL on graphics card struct pll_info { uint32 reference_frequency; uint32 max_frequency; uint32 min_frequency; uint32 divisor_register; }; struct ring_buffer { struct lock lock; uint32 register_base; uint32 offset; uint32 size; uint32 position; uint32 space_left; uint8* base; }; struct overlay_registers; struct radeon_shared_info { uint32 device_id; // device pciid area_id mode_list_area; // area containing display mode list uint32 mode_count; display_mode current_mode; uint32 bytes_per_row; uint32 bits_per_pixel; uint32 dpms_mode; area_id registers_area; // area of memory mapped registers uint8* status_page; addr_t physical_status_page; uint32 graphics_memory_size; addr_t frame_buffer_phys; // card PCI BAR address of FB area_id frame_buffer_area; // area of memory mapped FB uint32 frame_buffer_int; // card internal FB location uint32 frame_buffer_size; // card internal FB aperture size uint8* frame_buffer; // virtual memory mapped FB bool has_edid; edid1_info edid_info; struct lock accelerant_lock; struct lock engine_lock; ring_buffer primary_ring_buffer; int32 overlay_channel_used; bool overlay_active; uint32 overlay_token; addr_t physical_overlay_registers; uint32 overlay_offset; bool hardware_cursor_enabled; sem_id vblank_sem; uint8* cursor_memory; addr_t physical_cursor_memory; uint32 cursor_buffer_offset; uint32 cursor_format; bool cursor_visible; uint16 cursor_hot_x; uint16 cursor_hot_y; uint16 device_chipset; char device_identifier[32]; struct pll_info pll_info; }; //----------------- ioctl() interface ---------------- // magic code for ioctls #define RADEON_PRIVATE_DATA_MAGIC 'rdhd' // list ioctls enum { RADEON_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1, RADEON_GET_DEVICE_NAME, RADEON_ALLOCATE_GRAPHICS_MEMORY, RADEON_FREE_GRAPHICS_MEMORY }; // retrieve the area_id of the kernel/accelerant shared info struct radeon_get_private_data { uint32 magic; // magic number area_id shared_info_area; }; // allocate graphics memory struct radeon_allocate_graphics_memory { uint32 magic; uint32 size; uint32 alignment; uint32 flags; uint32 buffer_base; }; // free graphics memory struct radeon_free_graphics_memory { uint32 magic; uint32 buffer_base; }; // registers #define R6XX_CONFIG_APER_SIZE 0x5430 // r600> #define OLD_CONFIG_APER_SIZE 0x0108 //