Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Advanced Micro Devices, Inc. |
| 3 | * Copyright 2008 Red Hat Inc. |
| 4 | * Copyright 2009 Jerome Glisse. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 22 | * OTHER DEALINGS IN THE SOFTWARE. |
| 23 | * |
| 24 | * Authors: Dave Airlie |
| 25 | * Alex Deucher |
| 26 | * Jerome Glisse |
| 27 | */ |
| 28 | #ifndef __RADEON_H__ |
| 29 | #define __RADEON_H__ |
| 30 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 31 | /* TODO: Here are things that needs to be done : |
| 32 | * - surface allocator & initializer : (bit like scratch reg) should |
| 33 | * initialize HDP_ stuff on RS600, R600, R700 hw, well anythings |
| 34 | * related to surface |
| 35 | * - WB : write back stuff (do it bit like scratch reg things) |
| 36 | * - Vblank : look at Jesse's rework and what we should do |
| 37 | * - r600/r700: gart & cp |
| 38 | * - cs : clean cs ioctl use bitmap & things like that. |
| 39 | * - power management stuff |
| 40 | * - Barrier in gart code |
| 41 | * - Unmappabled vram ? |
| 42 | * - TESTING, TESTING, TESTING |
| 43 | */ |
| 44 | |
Jerome Glisse | d39c3b8 | 2009-09-28 18:34:43 +0200 | [diff] [blame] | 45 | /* Initialization path: |
| 46 | * We expect that acceleration initialization might fail for various |
| 47 | * reasons even thought we work hard to make it works on most |
| 48 | * configurations. In order to still have a working userspace in such |
| 49 | * situation the init path must succeed up to the memory controller |
| 50 | * initialization point. Failure before this point are considered as |
| 51 | * fatal error. Here is the init callchain : |
| 52 | * radeon_device_init perform common structure, mutex initialization |
| 53 | * asic_init setup the GPU memory layout and perform all |
| 54 | * one time initialization (failure in this |
| 55 | * function are considered fatal) |
| 56 | * asic_startup setup the GPU acceleration, in order to |
| 57 | * follow guideline the first thing this |
| 58 | * function should do is setting the GPU |
| 59 | * memory controller (only MC setup failure |
| 60 | * are considered as fatal) |
| 61 | */ |
| 62 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 63 | #include <asm/atomic.h> |
| 64 | #include <linux/wait.h> |
| 65 | #include <linux/list.h> |
| 66 | #include <linux/kref.h> |
| 67 | |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 68 | #include <ttm/ttm_bo_api.h> |
| 69 | #include <ttm/ttm_bo_driver.h> |
| 70 | #include <ttm/ttm_placement.h> |
| 71 | #include <ttm/ttm_module.h> |
| 72 | |
Dave Airlie | c214271 | 2009-09-22 08:50:10 +1000 | [diff] [blame] | 73 | #include "radeon_family.h" |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 74 | #include "radeon_mode.h" |
| 75 | #include "radeon_reg.h" |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 76 | |
| 77 | /* |
| 78 | * Modules parameters. |
| 79 | */ |
| 80 | extern int radeon_no_wb; |
| 81 | extern int radeon_modeset; |
| 82 | extern int radeon_dynclks; |
| 83 | extern int radeon_r4xx_atom; |
| 84 | extern int radeon_agpmode; |
| 85 | extern int radeon_vram_limit; |
| 86 | extern int radeon_gart_size; |
| 87 | extern int radeon_benchmarking; |
Michel Dänzer | ecc0b32 | 2009-07-21 11:23:57 +0200 | [diff] [blame] | 88 | extern int radeon_testing; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 89 | extern int radeon_connector_table; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 90 | extern int radeon_tv; |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 91 | extern int radeon_audio; |
Alex Deucher | f46c012 | 2010-03-31 00:33:27 -0400 | [diff] [blame] | 92 | extern int radeon_disp_priority; |
Alex Deucher | e2b0a8e | 2010-03-17 02:07:37 -0400 | [diff] [blame] | 93 | extern int radeon_hw_i2c; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 94 | |
| 95 | /* |
| 96 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
| 97 | * symbol; |
| 98 | */ |
| 99 | #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 100 | #define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) |
Jerome Glisse | e821767 | 2010-02-15 21:36:13 +0100 | [diff] [blame] | 101 | /* RADEON_IB_POOL_SIZE must be a power of 2 */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 102 | #define RADEON_IB_POOL_SIZE 16 |
| 103 | #define RADEON_DEBUGFS_MAX_NUM_FILES 32 |
| 104 | #define RADEONFB_CONN_LIMIT 4 |
Yang Zhao | f657c2a | 2009-09-15 12:21:01 +1000 | [diff] [blame] | 105 | #define RADEON_BIOS_NUM_SCRATCH 8 |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 106 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 107 | /* |
| 108 | * Errata workarounds. |
| 109 | */ |
| 110 | enum radeon_pll_errata { |
| 111 | CHIP_ERRATA_R300_CG = 0x00000001, |
| 112 | CHIP_ERRATA_PLL_DUMMYREADS = 0x00000002, |
| 113 | CHIP_ERRATA_PLL_DELAY = 0x00000004 |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | struct radeon_device; |
| 118 | |
| 119 | |
| 120 | /* |
| 121 | * BIOS. |
| 122 | */ |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 123 | #define ATRM_BIOS_PAGE 4096 |
| 124 | |
Dave Airlie | 8edb381 | 2010-03-01 21:50:01 +1100 | [diff] [blame] | 125 | #if defined(CONFIG_VGA_SWITCHEROO) |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 126 | bool radeon_atrm_supported(struct pci_dev *pdev); |
| 127 | int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len); |
Dave Airlie | 8edb381 | 2010-03-01 21:50:01 +1100 | [diff] [blame] | 128 | #else |
| 129 | static inline bool radeon_atrm_supported(struct pci_dev *pdev) |
| 130 | { |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){ |
| 135 | return -EINVAL; |
| 136 | } |
| 137 | #endif |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 138 | bool radeon_get_bios(struct radeon_device *rdev); |
| 139 | |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 140 | |
| 141 | /* |
| 142 | * Dummy page |
| 143 | */ |
| 144 | struct radeon_dummy_page { |
| 145 | struct page *page; |
| 146 | dma_addr_t addr; |
| 147 | }; |
| 148 | int radeon_dummy_page_init(struct radeon_device *rdev); |
| 149 | void radeon_dummy_page_fini(struct radeon_device *rdev); |
| 150 | |
| 151 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 152 | /* |
| 153 | * Clocks |
| 154 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 155 | struct radeon_clock { |
| 156 | struct radeon_pll p1pll; |
| 157 | struct radeon_pll p2pll; |
Alex Deucher | bcc1c2a | 2010-01-12 17:54:34 -0500 | [diff] [blame] | 158 | struct radeon_pll dcpll; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 159 | struct radeon_pll spll; |
| 160 | struct radeon_pll mpll; |
| 161 | /* 10 Khz units */ |
| 162 | uint32_t default_mclk; |
| 163 | uint32_t default_sclk; |
Alex Deucher | bcc1c2a | 2010-01-12 17:54:34 -0500 | [diff] [blame] | 164 | uint32_t default_dispclk; |
| 165 | uint32_t dp_extclk; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 166 | }; |
| 167 | |
Rafał Miłecki | 7433874 | 2009-11-03 00:53:02 +0100 | [diff] [blame] | 168 | /* |
| 169 | * Power management |
| 170 | */ |
| 171 | int radeon_pm_init(struct radeon_device *rdev); |
Alex Deucher | 29fb52c | 2010-03-11 10:01:17 -0500 | [diff] [blame] | 172 | void radeon_pm_fini(struct radeon_device *rdev); |
Rafał Miłecki | c913e23 | 2009-12-22 23:02:16 +0100 | [diff] [blame] | 173 | void radeon_pm_compute_clocks(struct radeon_device *rdev); |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 174 | void radeon_pm_suspend(struct radeon_device *rdev); |
| 175 | void radeon_pm_resume(struct radeon_device *rdev); |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 176 | void radeon_combios_get_power_modes(struct radeon_device *rdev); |
| 177 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); |
Alex Deucher | 7ac9aa5 | 2010-05-27 19:25:54 -0400 | [diff] [blame] | 178 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); |
Alex Deucher | f892034 | 2010-06-30 12:02:03 -0400 | [diff] [blame] | 179 | void rs690_pm_info(struct radeon_device *rdev); |
Alex Deucher | 21a8122 | 2010-07-02 12:58:16 -0400 | [diff] [blame] | 180 | extern u32 rv6xx_get_temp(struct radeon_device *rdev); |
| 181 | extern u32 rv770_get_temp(struct radeon_device *rdev); |
| 182 | extern u32 evergreen_get_temp(struct radeon_device *rdev); |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 183 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 184 | /* |
| 185 | * Fences. |
| 186 | */ |
| 187 | struct radeon_fence_driver { |
| 188 | uint32_t scratch_reg; |
| 189 | atomic_t seq; |
| 190 | uint32_t last_seq; |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 191 | unsigned long last_jiffies; |
| 192 | unsigned long last_timeout; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 193 | wait_queue_head_t queue; |
| 194 | rwlock_t lock; |
| 195 | struct list_head created; |
| 196 | struct list_head emited; |
| 197 | struct list_head signaled; |
Jerome Glisse | 0a0c759 | 2009-12-11 20:36:19 +0100 | [diff] [blame] | 198 | bool initialized; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | struct radeon_fence { |
| 202 | struct radeon_device *rdev; |
| 203 | struct kref kref; |
| 204 | struct list_head list; |
| 205 | /* protected by radeon_fence.lock */ |
| 206 | uint32_t seq; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 207 | bool emited; |
| 208 | bool signaled; |
| 209 | }; |
| 210 | |
| 211 | int radeon_fence_driver_init(struct radeon_device *rdev); |
| 212 | void radeon_fence_driver_fini(struct radeon_device *rdev); |
| 213 | int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence); |
| 214 | int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence); |
| 215 | void radeon_fence_process(struct radeon_device *rdev); |
| 216 | bool radeon_fence_signaled(struct radeon_fence *fence); |
| 217 | int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); |
| 218 | int radeon_fence_wait_next(struct radeon_device *rdev); |
| 219 | int radeon_fence_wait_last(struct radeon_device *rdev); |
| 220 | struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); |
| 221 | void radeon_fence_unref(struct radeon_fence **fence); |
| 222 | |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 223 | /* |
| 224 | * Tiling registers |
| 225 | */ |
| 226 | struct radeon_surface_reg { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 227 | struct radeon_bo *bo; |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 228 | }; |
| 229 | |
| 230 | #define RADEON_GEM_MAX_SURFACES 8 |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 231 | |
| 232 | /* |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 233 | * TTM. |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 234 | */ |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 235 | struct radeon_mman { |
| 236 | struct ttm_bo_global_ref bo_global_ref; |
Dave Airlie | ba4420c | 2010-03-09 10:56:52 +1000 | [diff] [blame] | 237 | struct drm_global_reference mem_global_ref; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 238 | struct ttm_bo_device bdev; |
Jerome Glisse | 0a0c759 | 2009-12-11 20:36:19 +0100 | [diff] [blame] | 239 | bool mem_global_referenced; |
| 240 | bool initialized; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 241 | }; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 242 | |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 243 | struct radeon_bo { |
| 244 | /* Protected by gem.mutex */ |
| 245 | struct list_head list; |
| 246 | /* Protected by tbo.reserved */ |
Jerome Glisse | 312ea8d | 2009-12-07 15:52:58 +0100 | [diff] [blame] | 247 | u32 placements[3]; |
| 248 | struct ttm_placement placement; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 249 | struct ttm_buffer_object tbo; |
| 250 | struct ttm_bo_kmap_obj kmap; |
| 251 | unsigned pin_count; |
| 252 | void *kptr; |
| 253 | u32 tiling_flags; |
| 254 | u32 pitch; |
| 255 | int surface_reg; |
| 256 | /* Constant after initialization */ |
| 257 | struct radeon_device *rdev; |
| 258 | struct drm_gem_object *gobj; |
| 259 | }; |
| 260 | |
| 261 | struct radeon_bo_list { |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 262 | struct list_head list; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 263 | struct radeon_bo *bo; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 264 | uint64_t gpu_offset; |
| 265 | unsigned rdomain; |
| 266 | unsigned wdomain; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 267 | u32 tiling_flags; |
Jerome Glisse | e865275 | 2010-05-19 16:05:50 +0200 | [diff] [blame] | 268 | bool reserved; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 269 | }; |
| 270 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 271 | /* |
| 272 | * GEM objects. |
| 273 | */ |
| 274 | struct radeon_gem { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 275 | struct mutex mutex; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 276 | struct list_head objects; |
| 277 | }; |
| 278 | |
| 279 | int radeon_gem_init(struct radeon_device *rdev); |
| 280 | void radeon_gem_fini(struct radeon_device *rdev); |
| 281 | int radeon_gem_object_create(struct radeon_device *rdev, int size, |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 282 | int alignment, int initial_domain, |
| 283 | bool discardable, bool kernel, |
| 284 | struct drm_gem_object **obj); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 285 | int radeon_gem_object_pin(struct drm_gem_object *obj, uint32_t pin_domain, |
| 286 | uint64_t *gpu_addr); |
| 287 | void radeon_gem_object_unpin(struct drm_gem_object *obj); |
| 288 | |
| 289 | |
| 290 | /* |
| 291 | * GART structures, functions & helpers |
| 292 | */ |
| 293 | struct radeon_mc; |
| 294 | |
| 295 | struct radeon_gart_table_ram { |
| 296 | volatile uint32_t *ptr; |
| 297 | }; |
| 298 | |
| 299 | struct radeon_gart_table_vram { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 300 | struct radeon_bo *robj; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 301 | volatile uint32_t *ptr; |
| 302 | }; |
| 303 | |
| 304 | union radeon_gart_table { |
| 305 | struct radeon_gart_table_ram ram; |
| 306 | struct radeon_gart_table_vram vram; |
| 307 | }; |
| 308 | |
Matt Turner | a77f171 | 2009-10-14 00:34:41 -0400 | [diff] [blame] | 309 | #define RADEON_GPU_PAGE_SIZE 4096 |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 310 | #define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1) |
Matt Turner | a77f171 | 2009-10-14 00:34:41 -0400 | [diff] [blame] | 311 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 312 | struct radeon_gart { |
| 313 | dma_addr_t table_addr; |
| 314 | unsigned num_gpu_pages; |
| 315 | unsigned num_cpu_pages; |
| 316 | unsigned table_size; |
| 317 | union radeon_gart_table table; |
| 318 | struct page **pages; |
| 319 | dma_addr_t *pages_addr; |
| 320 | bool ready; |
| 321 | }; |
| 322 | |
| 323 | int radeon_gart_table_ram_alloc(struct radeon_device *rdev); |
| 324 | void radeon_gart_table_ram_free(struct radeon_device *rdev); |
| 325 | int radeon_gart_table_vram_alloc(struct radeon_device *rdev); |
| 326 | void radeon_gart_table_vram_free(struct radeon_device *rdev); |
| 327 | int radeon_gart_init(struct radeon_device *rdev); |
| 328 | void radeon_gart_fini(struct radeon_device *rdev); |
| 329 | void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, |
| 330 | int pages); |
| 331 | int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, |
| 332 | int pages, struct page **pagelist); |
| 333 | |
| 334 | |
| 335 | /* |
| 336 | * GPU MC structures, functions & helpers |
| 337 | */ |
| 338 | struct radeon_mc { |
| 339 | resource_size_t aper_size; |
| 340 | resource_size_t aper_base; |
| 341 | resource_size_t agp_base; |
Dave Airlie | 7a50f01 | 2009-07-21 20:39:30 +1000 | [diff] [blame] | 342 | /* for some chips with <= 32MB we need to lie |
| 343 | * about vram size near mc fb location */ |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 344 | u64 mc_vram_size; |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 345 | u64 visible_vram_size; |
Jerome Glisse | c919b37 | 2010-08-10 17:41:31 -0400 | [diff] [blame] | 346 | u64 active_vram_size; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 347 | u64 gtt_size; |
| 348 | u64 gtt_start; |
| 349 | u64 gtt_end; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 350 | u64 vram_start; |
| 351 | u64 vram_end; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 352 | unsigned vram_width; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 353 | u64 real_vram_size; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 354 | int vram_mtrr; |
| 355 | bool vram_is_ddr; |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 356 | bool igp_sideport_enabled; |
Alex Deucher | 8d369bb | 2010-07-15 10:51:10 -0400 | [diff] [blame] | 357 | u64 gtt_base_align; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 358 | }; |
| 359 | |
Alex Deucher | 06b6476 | 2010-01-05 11:27:29 -0500 | [diff] [blame] | 360 | bool radeon_combios_sideport_present(struct radeon_device *rdev); |
| 361 | bool radeon_atombios_sideport_present(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 362 | |
| 363 | /* |
| 364 | * GPU scratch registers structures, functions & helpers |
| 365 | */ |
| 366 | struct radeon_scratch { |
| 367 | unsigned num_reg; |
Alex Deucher | 724c80e | 2010-08-27 18:25:25 -0400 | [diff] [blame] | 368 | uint32_t reg_base; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 369 | bool free[32]; |
| 370 | uint32_t reg[32]; |
| 371 | }; |
| 372 | |
| 373 | int radeon_scratch_get(struct radeon_device *rdev, uint32_t *reg); |
| 374 | void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg); |
| 375 | |
| 376 | |
| 377 | /* |
| 378 | * IRQS. |
| 379 | */ |
| 380 | struct radeon_irq { |
| 381 | bool installed; |
| 382 | bool sw_int; |
| 383 | /* FIXME: use a define max crtc rather than hardcode it */ |
Alex Deucher | 45f9a39 | 2010-03-24 13:55:51 -0400 | [diff] [blame] | 384 | bool crtc_vblank_int[6]; |
Rafał Miłecki | 73a6d3f | 2010-01-08 00:22:47 +0100 | [diff] [blame] | 385 | wait_queue_head_t vblank_queue; |
Alex Deucher | b500f68 | 2009-12-03 13:08:53 -0500 | [diff] [blame] | 386 | /* FIXME: use defines for max hpd/dacs */ |
| 387 | bool hpd[6]; |
Alex Deucher | 2031f77 | 2010-04-22 12:52:11 -0400 | [diff] [blame] | 388 | bool gui_idle; |
| 389 | bool gui_idle_acked; |
| 390 | wait_queue_head_t idle_queue; |
Christian Koenig | f259493 | 2010-04-10 03:13:16 +0200 | [diff] [blame] | 391 | /* FIXME: use defines for max HDMI blocks */ |
| 392 | bool hdmi[2]; |
Dave Airlie | 1614f8b | 2009-12-01 16:04:56 +1000 | [diff] [blame] | 393 | spinlock_t sw_lock; |
| 394 | int sw_refcount; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | int radeon_irq_kms_init(struct radeon_device *rdev); |
| 398 | void radeon_irq_kms_fini(struct radeon_device *rdev); |
Dave Airlie | 1614f8b | 2009-12-01 16:04:56 +1000 | [diff] [blame] | 399 | void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev); |
| 400 | void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 401 | |
| 402 | /* |
| 403 | * CP & ring. |
| 404 | */ |
| 405 | struct radeon_ib { |
| 406 | struct list_head list; |
Jerome Glisse | e821767 | 2010-02-15 21:36:13 +0100 | [diff] [blame] | 407 | unsigned idx; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 408 | uint64_t gpu_addr; |
| 409 | struct radeon_fence *fence; |
Jerome Glisse | e821767 | 2010-02-15 21:36:13 +0100 | [diff] [blame] | 410 | uint32_t *ptr; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 411 | uint32_t length_dw; |
Jerome Glisse | e821767 | 2010-02-15 21:36:13 +0100 | [diff] [blame] | 412 | bool free; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 413 | }; |
| 414 | |
Dave Airlie | ecb114a | 2009-09-15 11:12:56 +1000 | [diff] [blame] | 415 | /* |
| 416 | * locking - |
| 417 | * mutex protects scheduled_ibs, ready, alloc_bm |
| 418 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 419 | struct radeon_ib_pool { |
| 420 | struct mutex mutex; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 421 | struct radeon_bo *robj; |
Jerome Glisse | 9f93ed3 | 2010-01-28 18:22:31 +0100 | [diff] [blame] | 422 | struct list_head bogus_ib; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 423 | struct radeon_ib ibs[RADEON_IB_POOL_SIZE]; |
| 424 | bool ready; |
Jerome Glisse | e821767 | 2010-02-15 21:36:13 +0100 | [diff] [blame] | 425 | unsigned head_id; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 426 | }; |
| 427 | |
| 428 | struct radeon_cp { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 429 | struct radeon_bo *ring_obj; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 430 | volatile uint32_t *ring; |
| 431 | unsigned rptr; |
| 432 | unsigned wptr; |
| 433 | unsigned wptr_old; |
| 434 | unsigned ring_size; |
| 435 | unsigned ring_free_dw; |
| 436 | int count_dw; |
| 437 | uint64_t gpu_addr; |
| 438 | uint32_t align_mask; |
| 439 | uint32_t ptr_mask; |
| 440 | struct mutex mutex; |
| 441 | bool ready; |
| 442 | }; |
| 443 | |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 444 | /* |
| 445 | * R6xx+ IH ring |
| 446 | */ |
| 447 | struct r600_ih { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 448 | struct radeon_bo *ring_obj; |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 449 | volatile uint32_t *ring; |
| 450 | unsigned rptr; |
| 451 | unsigned wptr; |
| 452 | unsigned wptr_old; |
| 453 | unsigned ring_size; |
| 454 | uint64_t gpu_addr; |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 455 | uint32_t ptr_mask; |
| 456 | spinlock_t lock; |
| 457 | bool enabled; |
| 458 | }; |
| 459 | |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 460 | struct r600_blit { |
Jerome Glisse | ff82f05 | 2010-01-22 15:19:00 +0100 | [diff] [blame] | 461 | struct mutex mutex; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 462 | struct radeon_bo *shader_obj; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 463 | u64 shader_gpu_addr; |
| 464 | u32 vs_offset, ps_offset; |
| 465 | u32 state_offset; |
| 466 | u32 state_len; |
| 467 | u32 vb_used, vb_total; |
| 468 | struct radeon_ib *vb_ib; |
| 469 | }; |
| 470 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 471 | int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib); |
| 472 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); |
| 473 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); |
| 474 | int radeon_ib_pool_init(struct radeon_device *rdev); |
| 475 | void radeon_ib_pool_fini(struct radeon_device *rdev); |
| 476 | int radeon_ib_test(struct radeon_device *rdev); |
Jerome Glisse | 9f93ed3 | 2010-01-28 18:22:31 +0100 | [diff] [blame] | 477 | extern void radeon_ib_bogus_add(struct radeon_device *rdev, struct radeon_ib *ib); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 478 | /* Ring access between begin & end cannot sleep */ |
| 479 | void radeon_ring_free_size(struct radeon_device *rdev); |
Matthew Garrett | 91700f3 | 2010-04-30 15:24:17 -0400 | [diff] [blame] | 480 | int radeon_ring_alloc(struct radeon_device *rdev, unsigned ndw); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 481 | int radeon_ring_lock(struct radeon_device *rdev, unsigned ndw); |
Matthew Garrett | 91700f3 | 2010-04-30 15:24:17 -0400 | [diff] [blame] | 482 | void radeon_ring_commit(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 483 | void radeon_ring_unlock_commit(struct radeon_device *rdev); |
| 484 | void radeon_ring_unlock_undo(struct radeon_device *rdev); |
| 485 | int radeon_ring_test(struct radeon_device *rdev); |
| 486 | int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size); |
| 487 | void radeon_ring_fini(struct radeon_device *rdev); |
| 488 | |
| 489 | |
| 490 | /* |
| 491 | * CS. |
| 492 | */ |
| 493 | struct radeon_cs_reloc { |
| 494 | struct drm_gem_object *gobj; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 495 | struct radeon_bo *robj; |
| 496 | struct radeon_bo_list lobj; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 497 | uint32_t handle; |
| 498 | uint32_t flags; |
| 499 | }; |
| 500 | |
| 501 | struct radeon_cs_chunk { |
| 502 | uint32_t chunk_id; |
| 503 | uint32_t length_dw; |
Dave Airlie | 513bcb4 | 2009-09-23 16:56:27 +1000 | [diff] [blame] | 504 | int kpage_idx[2]; |
| 505 | uint32_t *kpage[2]; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 506 | uint32_t *kdata; |
Dave Airlie | 513bcb4 | 2009-09-23 16:56:27 +1000 | [diff] [blame] | 507 | void __user *user_ptr; |
| 508 | int last_copied_page; |
| 509 | int last_page_index; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | struct radeon_cs_parser { |
Jerome Glisse | c8c15ff | 2010-01-18 13:01:36 +0100 | [diff] [blame] | 513 | struct device *dev; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 514 | struct radeon_device *rdev; |
| 515 | struct drm_file *filp; |
| 516 | /* chunks */ |
| 517 | unsigned nchunks; |
| 518 | struct radeon_cs_chunk *chunks; |
| 519 | uint64_t *chunks_array; |
| 520 | /* IB */ |
| 521 | unsigned idx; |
| 522 | /* relocations */ |
| 523 | unsigned nrelocs; |
| 524 | struct radeon_cs_reloc *relocs; |
| 525 | struct radeon_cs_reloc **relocs_ptr; |
| 526 | struct list_head validated; |
| 527 | /* indices of various chunks */ |
| 528 | int chunk_ib_idx; |
| 529 | int chunk_relocs_idx; |
| 530 | struct radeon_ib *ib; |
| 531 | void *track; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 532 | unsigned family; |
Dave Airlie | 513bcb4 | 2009-09-23 16:56:27 +1000 | [diff] [blame] | 533 | int parser_error; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 534 | }; |
| 535 | |
Dave Airlie | 513bcb4 | 2009-09-23 16:56:27 +1000 | [diff] [blame] | 536 | extern int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx); |
| 537 | extern int radeon_cs_finish_pages(struct radeon_cs_parser *p); |
| 538 | |
| 539 | |
| 540 | static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) |
| 541 | { |
| 542 | struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; |
| 543 | u32 pg_idx, pg_offset; |
| 544 | u32 idx_value = 0; |
| 545 | int new_page; |
| 546 | |
| 547 | pg_idx = (idx * 4) / PAGE_SIZE; |
| 548 | pg_offset = (idx * 4) % PAGE_SIZE; |
| 549 | |
| 550 | if (ibc->kpage_idx[0] == pg_idx) |
| 551 | return ibc->kpage[0][pg_offset/4]; |
| 552 | if (ibc->kpage_idx[1] == pg_idx) |
| 553 | return ibc->kpage[1][pg_offset/4]; |
| 554 | |
| 555 | new_page = radeon_cs_update_pages(p, pg_idx); |
| 556 | if (new_page < 0) { |
| 557 | p->parser_error = new_page; |
| 558 | return 0; |
| 559 | } |
| 560 | |
| 561 | idx_value = ibc->kpage[new_page][pg_offset/4]; |
| 562 | return idx_value; |
| 563 | } |
| 564 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 565 | struct radeon_cs_packet { |
| 566 | unsigned idx; |
| 567 | unsigned type; |
| 568 | unsigned reg; |
| 569 | unsigned opcode; |
| 570 | int count; |
| 571 | unsigned one_reg_wr; |
| 572 | }; |
| 573 | |
| 574 | typedef int (*radeon_packet0_check_t)(struct radeon_cs_parser *p, |
| 575 | struct radeon_cs_packet *pkt, |
| 576 | unsigned idx, unsigned reg); |
| 577 | typedef int (*radeon_packet3_check_t)(struct radeon_cs_parser *p, |
| 578 | struct radeon_cs_packet *pkt); |
| 579 | |
| 580 | |
| 581 | /* |
| 582 | * AGP |
| 583 | */ |
| 584 | int radeon_agp_init(struct radeon_device *rdev); |
Dave Airlie | 0ebf171 | 2009-11-05 15:39:10 +1000 | [diff] [blame] | 585 | void radeon_agp_resume(struct radeon_device *rdev); |
Jerome Glisse | 10b0612 | 2010-05-21 18:48:54 +0200 | [diff] [blame] | 586 | void radeon_agp_suspend(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 587 | void radeon_agp_fini(struct radeon_device *rdev); |
| 588 | |
| 589 | |
| 590 | /* |
| 591 | * Writeback |
| 592 | */ |
| 593 | struct radeon_wb { |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 594 | struct radeon_bo *wb_obj; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 595 | volatile uint32_t *wb; |
| 596 | uint64_t gpu_addr; |
Alex Deucher | 724c80e | 2010-08-27 18:25:25 -0400 | [diff] [blame] | 597 | bool enabled; |
Alex Deucher | d0f8a85 | 2010-09-04 05:04:34 -0400 | [diff] [blame] | 598 | bool use_event; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 599 | }; |
| 600 | |
Alex Deucher | 724c80e | 2010-08-27 18:25:25 -0400 | [diff] [blame] | 601 | #define RADEON_WB_SCRATCH_OFFSET 0 |
| 602 | #define RADEON_WB_CP_RPTR_OFFSET 1024 |
| 603 | #define R600_WB_IH_WPTR_OFFSET 2048 |
Alex Deucher | d0f8a85 | 2010-09-04 05:04:34 -0400 | [diff] [blame] | 604 | #define R600_WB_EVENT_OFFSET 3072 |
Alex Deucher | 724c80e | 2010-08-27 18:25:25 -0400 | [diff] [blame] | 605 | |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 606 | /** |
| 607 | * struct radeon_pm - power management datas |
| 608 | * @max_bandwidth: maximum bandwidth the gpu has (MByte/s) |
| 609 | * @igp_sideport_mclk: sideport memory clock Mhz (rs690,rs740,rs780,rs880) |
| 610 | * @igp_system_mclk: system clock Mhz (rs690,rs740,rs780,rs880) |
| 611 | * @igp_ht_link_clk: ht link clock Mhz (rs690,rs740,rs780,rs880) |
| 612 | * @igp_ht_link_width: ht link width in bits (rs690,rs740,rs780,rs880) |
| 613 | * @k8_bandwidth: k8 bandwidth the gpu has (MByte/s) (IGP) |
| 614 | * @sideport_bandwidth: sideport bandwidth the gpu has (MByte/s) (IGP) |
| 615 | * @ht_bandwidth: ht bandwidth the gpu has (MByte/s) (IGP) |
| 616 | * @core_bandwidth: core GPU bandwidth the gpu has (MByte/s) (IGP) |
| 617 | * @sclk: GPU clock Mhz (core bandwith depends of this clock) |
| 618 | * @needed_bandwidth: current bandwidth needs |
| 619 | * |
| 620 | * It keeps track of various data needed to take powermanagement decision. |
| 621 | * Bandwith need is used to determine minimun clock of the GPU and memory. |
| 622 | * Equation between gpu/memory clock and available bandwidth is hw dependent |
| 623 | * (type of memory, bus size, efficiency, ...) |
| 624 | */ |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 625 | |
| 626 | enum radeon_pm_method { |
| 627 | PM_METHOD_PROFILE, |
| 628 | PM_METHOD_DYNPM, |
Rafał Miłecki | c913e23 | 2009-12-22 23:02:16 +0100 | [diff] [blame] | 629 | }; |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 630 | |
| 631 | enum radeon_dynpm_state { |
| 632 | DYNPM_STATE_DISABLED, |
| 633 | DYNPM_STATE_MINIMUM, |
| 634 | DYNPM_STATE_PAUSED, |
Rafael J. Wysocki | 3f53eb6 | 2010-06-17 23:02:27 +0000 | [diff] [blame] | 635 | DYNPM_STATE_ACTIVE, |
| 636 | DYNPM_STATE_SUSPENDED, |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 637 | }; |
| 638 | enum radeon_dynpm_action { |
| 639 | DYNPM_ACTION_NONE, |
| 640 | DYNPM_ACTION_MINIMUM, |
| 641 | DYNPM_ACTION_DOWNCLOCK, |
| 642 | DYNPM_ACTION_UPCLOCK, |
| 643 | DYNPM_ACTION_DEFAULT |
Rafał Miłecki | c913e23 | 2009-12-22 23:02:16 +0100 | [diff] [blame] | 644 | }; |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 645 | |
| 646 | enum radeon_voltage_type { |
| 647 | VOLTAGE_NONE = 0, |
| 648 | VOLTAGE_GPIO, |
| 649 | VOLTAGE_VDDC, |
| 650 | VOLTAGE_SW |
| 651 | }; |
| 652 | |
Alex Deucher | 0ec0e74 | 2009-12-23 13:21:58 -0500 | [diff] [blame] | 653 | enum radeon_pm_state_type { |
| 654 | POWER_STATE_TYPE_DEFAULT, |
| 655 | POWER_STATE_TYPE_POWERSAVE, |
| 656 | POWER_STATE_TYPE_BATTERY, |
| 657 | POWER_STATE_TYPE_BALANCED, |
| 658 | POWER_STATE_TYPE_PERFORMANCE, |
| 659 | }; |
| 660 | |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 661 | enum radeon_pm_profile_type { |
| 662 | PM_PROFILE_DEFAULT, |
| 663 | PM_PROFILE_AUTO, |
| 664 | PM_PROFILE_LOW, |
Alex Deucher | c9e75b2 | 2010-06-02 17:56:01 -0400 | [diff] [blame] | 665 | PM_PROFILE_MID, |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 666 | PM_PROFILE_HIGH, |
| 667 | }; |
| 668 | |
| 669 | #define PM_PROFILE_DEFAULT_IDX 0 |
| 670 | #define PM_PROFILE_LOW_SH_IDX 1 |
Alex Deucher | c9e75b2 | 2010-06-02 17:56:01 -0400 | [diff] [blame] | 671 | #define PM_PROFILE_MID_SH_IDX 2 |
| 672 | #define PM_PROFILE_HIGH_SH_IDX 3 |
| 673 | #define PM_PROFILE_LOW_MH_IDX 4 |
| 674 | #define PM_PROFILE_MID_MH_IDX 5 |
| 675 | #define PM_PROFILE_HIGH_MH_IDX 6 |
| 676 | #define PM_PROFILE_MAX 7 |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 677 | |
| 678 | struct radeon_pm_profile { |
| 679 | int dpms_off_ps_idx; |
| 680 | int dpms_on_ps_idx; |
| 681 | int dpms_off_cm_idx; |
| 682 | int dpms_on_cm_idx; |
Alex Deucher | 516d0e4 | 2009-12-23 14:28:05 -0500 | [diff] [blame] | 683 | }; |
| 684 | |
Alex Deucher | 21a8122 | 2010-07-02 12:58:16 -0400 | [diff] [blame] | 685 | enum radeon_int_thermal_type { |
| 686 | THERMAL_TYPE_NONE, |
| 687 | THERMAL_TYPE_RV6XX, |
| 688 | THERMAL_TYPE_RV770, |
| 689 | THERMAL_TYPE_EVERGREEN, |
| 690 | }; |
| 691 | |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 692 | struct radeon_voltage { |
| 693 | enum radeon_voltage_type type; |
| 694 | /* gpio voltage */ |
| 695 | struct radeon_gpio_rec gpio; |
| 696 | u32 delay; /* delay in usec from voltage drop to sclk change */ |
| 697 | bool active_high; /* voltage drop is active when bit is high */ |
| 698 | /* VDDC voltage */ |
| 699 | u8 vddc_id; /* index into vddc voltage table */ |
| 700 | u8 vddci_id; /* index into vddci voltage table */ |
| 701 | bool vddci_enabled; |
| 702 | /* r6xx+ sw */ |
| 703 | u32 voltage; |
| 704 | }; |
| 705 | |
Alex Deucher | d731117 | 2010-05-03 01:13:14 -0400 | [diff] [blame] | 706 | /* clock mode flags */ |
| 707 | #define RADEON_PM_MODE_NO_DISPLAY (1 << 0) |
| 708 | |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 709 | struct radeon_pm_clock_info { |
| 710 | /* memory clock */ |
| 711 | u32 mclk; |
| 712 | /* engine clock */ |
| 713 | u32 sclk; |
| 714 | /* voltage info */ |
| 715 | struct radeon_voltage voltage; |
Alex Deucher | d731117 | 2010-05-03 01:13:14 -0400 | [diff] [blame] | 716 | /* standardized clock flags */ |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 717 | u32 flags; |
| 718 | }; |
| 719 | |
Alex Deucher | a48b9b4 | 2010-04-22 14:03:55 -0400 | [diff] [blame] | 720 | /* state flags */ |
Alex Deucher | d731117 | 2010-05-03 01:13:14 -0400 | [diff] [blame] | 721 | #define RADEON_PM_STATE_SINGLE_DISPLAY_ONLY (1 << 0) |
Alex Deucher | a48b9b4 | 2010-04-22 14:03:55 -0400 | [diff] [blame] | 722 | |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 723 | struct radeon_power_state { |
Alex Deucher | 0ec0e74 | 2009-12-23 13:21:58 -0500 | [diff] [blame] | 724 | enum radeon_pm_state_type type; |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 725 | /* XXX: use a define for num clock modes */ |
| 726 | struct radeon_pm_clock_info clock_info[8]; |
| 727 | /* number of valid clock modes in this power state */ |
| 728 | int num_clock_modes; |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 729 | struct radeon_pm_clock_info *default_clock_mode; |
Alex Deucher | a48b9b4 | 2010-04-22 14:03:55 -0400 | [diff] [blame] | 730 | /* standardized state flags */ |
| 731 | u32 flags; |
Alex Deucher | 79daedc | 2010-04-22 14:25:19 -0400 | [diff] [blame] | 732 | u32 misc; /* vbios specific flags */ |
| 733 | u32 misc2; /* vbios specific flags */ |
| 734 | int pcie_lanes; /* pcie lanes */ |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 735 | }; |
| 736 | |
Rafał Miłecki | 2745932 | 2010-02-11 22:16:36 +0000 | [diff] [blame] | 737 | /* |
| 738 | * Some modes are overclocked by very low value, accept them |
| 739 | */ |
| 740 | #define RADEON_MODE_OVERCLOCK_MARGIN 500 /* 5 MHz */ |
| 741 | |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 742 | struct radeon_pm { |
Rafał Miłecki | c913e23 | 2009-12-22 23:02:16 +0100 | [diff] [blame] | 743 | struct mutex mutex; |
Alex Deucher | a48b9b4 | 2010-04-22 14:03:55 -0400 | [diff] [blame] | 744 | u32 active_crtcs; |
| 745 | int active_crtc_count; |
Rafał Miłecki | c913e23 | 2009-12-22 23:02:16 +0100 | [diff] [blame] | 746 | int req_vblank; |
Rafał Miłecki | 839461d | 2010-03-02 22:06:51 +0100 | [diff] [blame] | 747 | bool vblank_sync; |
Alex Deucher | 2031f77 | 2010-04-22 12:52:11 -0400 | [diff] [blame] | 748 | bool gui_idle; |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 749 | fixed20_12 max_bandwidth; |
| 750 | fixed20_12 igp_sideport_mclk; |
| 751 | fixed20_12 igp_system_mclk; |
| 752 | fixed20_12 igp_ht_link_clk; |
| 753 | fixed20_12 igp_ht_link_width; |
| 754 | fixed20_12 k8_bandwidth; |
| 755 | fixed20_12 sideport_bandwidth; |
| 756 | fixed20_12 ht_bandwidth; |
| 757 | fixed20_12 core_bandwidth; |
| 758 | fixed20_12 sclk; |
Alex Deucher | f47299c | 2010-03-16 20:54:38 -0400 | [diff] [blame] | 759 | fixed20_12 mclk; |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 760 | fixed20_12 needed_bandwidth; |
Alex Deucher | 56278a8 | 2009-12-28 13:58:44 -0500 | [diff] [blame] | 761 | /* XXX: use a define for num power modes */ |
| 762 | struct radeon_power_state power_state[8]; |
| 763 | /* number of valid power states */ |
| 764 | int num_power_states; |
Alex Deucher | a48b9b4 | 2010-04-22 14:03:55 -0400 | [diff] [blame] | 765 | int current_power_state_index; |
| 766 | int current_clock_mode_index; |
| 767 | int requested_power_state_index; |
| 768 | int requested_clock_mode_index; |
| 769 | int default_power_state_index; |
| 770 | u32 current_sclk; |
| 771 | u32 current_mclk; |
Alex Deucher | 4d60173 | 2010-06-07 18:15:18 -0400 | [diff] [blame] | 772 | u32 current_vddc; |
Alex Deucher | 29fb52c | 2010-03-11 10:01:17 -0500 | [diff] [blame] | 773 | struct radeon_i2c_chan *i2c_bus; |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 774 | /* selected pm method */ |
| 775 | enum radeon_pm_method pm_method; |
| 776 | /* dynpm power management */ |
| 777 | struct delayed_work dynpm_idle_work; |
| 778 | enum radeon_dynpm_state dynpm_state; |
| 779 | enum radeon_dynpm_action dynpm_planned_action; |
| 780 | unsigned long dynpm_action_timeout; |
| 781 | bool dynpm_can_upclock; |
| 782 | bool dynpm_can_downclock; |
| 783 | /* profile-based power management */ |
| 784 | enum radeon_pm_profile_type profile; |
| 785 | int profile_index; |
| 786 | struct radeon_pm_profile profiles[PM_PROFILE_MAX]; |
Alex Deucher | 21a8122 | 2010-07-02 12:58:16 -0400 | [diff] [blame] | 787 | /* internal thermal controller on rv6xx+ */ |
| 788 | enum radeon_int_thermal_type int_thermal_type; |
| 789 | struct device *int_hwmon_dev; |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 790 | }; |
| 791 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 792 | |
| 793 | /* |
| 794 | * Benchmarking |
| 795 | */ |
| 796 | void radeon_benchmark(struct radeon_device *rdev); |
| 797 | |
| 798 | |
| 799 | /* |
Michel Dänzer | ecc0b32 | 2009-07-21 11:23:57 +0200 | [diff] [blame] | 800 | * Testing |
| 801 | */ |
| 802 | void radeon_test_moves(struct radeon_device *rdev); |
| 803 | |
| 804 | |
| 805 | /* |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 806 | * Debugfs |
| 807 | */ |
| 808 | int radeon_debugfs_add_files(struct radeon_device *rdev, |
| 809 | struct drm_info_list *files, |
| 810 | unsigned nfiles); |
| 811 | int radeon_debugfs_fence_init(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 812 | |
| 813 | |
| 814 | /* |
| 815 | * ASIC specific functions. |
| 816 | */ |
| 817 | struct radeon_asic { |
Jerome Glisse | 068a117 | 2009-06-17 13:28:30 +0200 | [diff] [blame] | 818 | int (*init)(struct radeon_device *rdev); |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 819 | void (*fini)(struct radeon_device *rdev); |
| 820 | int (*resume)(struct radeon_device *rdev); |
| 821 | int (*suspend)(struct radeon_device *rdev); |
Dave Airlie | 28d5204 | 2009-09-21 14:33:58 +1000 | [diff] [blame] | 822 | void (*vga_set_state)(struct radeon_device *rdev, bool state); |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 823 | bool (*gpu_is_lockup)(struct radeon_device *rdev); |
Jerome Glisse | a2d07b7 | 2010-03-09 14:45:11 +0000 | [diff] [blame] | 824 | int (*asic_reset)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 825 | void (*gart_tlb_flush)(struct radeon_device *rdev); |
| 826 | int (*gart_set_page)(struct radeon_device *rdev, int i, uint64_t addr); |
| 827 | int (*cp_init)(struct radeon_device *rdev, unsigned ring_size); |
| 828 | void (*cp_fini)(struct radeon_device *rdev); |
| 829 | void (*cp_disable)(struct radeon_device *rdev); |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 830 | void (*cp_commit)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 831 | void (*ring_start)(struct radeon_device *rdev); |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 832 | int (*ring_test)(struct radeon_device *rdev); |
| 833 | void (*ring_ib_execute)(struct radeon_device *rdev, struct radeon_ib *ib); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 834 | int (*irq_set)(struct radeon_device *rdev); |
| 835 | int (*irq_process)(struct radeon_device *rdev); |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 836 | u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 837 | void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence); |
| 838 | int (*cs_parse)(struct radeon_cs_parser *p); |
| 839 | int (*copy_blit)(struct radeon_device *rdev, |
| 840 | uint64_t src_offset, |
| 841 | uint64_t dst_offset, |
| 842 | unsigned num_pages, |
| 843 | struct radeon_fence *fence); |
| 844 | int (*copy_dma)(struct radeon_device *rdev, |
| 845 | uint64_t src_offset, |
| 846 | uint64_t dst_offset, |
| 847 | unsigned num_pages, |
| 848 | struct radeon_fence *fence); |
| 849 | int (*copy)(struct radeon_device *rdev, |
| 850 | uint64_t src_offset, |
| 851 | uint64_t dst_offset, |
| 852 | unsigned num_pages, |
| 853 | struct radeon_fence *fence); |
Rafał Miłecki | 7433874 | 2009-11-03 00:53:02 +0100 | [diff] [blame] | 854 | uint32_t (*get_engine_clock)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 855 | void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock); |
Rafał Miłecki | 7433874 | 2009-11-03 00:53:02 +0100 | [diff] [blame] | 856 | uint32_t (*get_memory_clock)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 857 | void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock); |
Alex Deucher | c836a41 | 2009-12-23 10:07:50 -0500 | [diff] [blame] | 858 | int (*get_pcie_lanes)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 859 | void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes); |
| 860 | void (*set_clock_gating)(struct radeon_device *rdev, int enable); |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 861 | int (*set_surface_reg)(struct radeon_device *rdev, int reg, |
| 862 | uint32_t tiling_flags, uint32_t pitch, |
| 863 | uint32_t offset, uint32_t obj_size); |
Daniel Vetter | 9479c54 | 2010-03-11 21:19:16 +0000 | [diff] [blame] | 864 | void (*clear_surface_reg)(struct radeon_device *rdev, int reg); |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 865 | void (*bandwidth_update)(struct radeon_device *rdev); |
Alex Deucher | 429770b | 2009-12-04 15:26:55 -0500 | [diff] [blame] | 866 | void (*hpd_init)(struct radeon_device *rdev); |
| 867 | void (*hpd_fini)(struct radeon_device *rdev); |
| 868 | bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
| 869 | void (*hpd_set_polarity)(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
Jerome Glisse | 062b389 | 2010-02-04 20:36:39 +0100 | [diff] [blame] | 870 | /* ioctl hw specific callback. Some hw might want to perform special |
| 871 | * operation on specific ioctl. For instance on wait idle some hw |
| 872 | * might want to perform and HDP flush through MMIO as it seems that |
| 873 | * some R6XX/R7XX hw doesn't take HDP flush into account if programmed |
| 874 | * through ring. |
| 875 | */ |
| 876 | void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo); |
Alex Deucher | def9ba9 | 2010-04-22 12:39:58 -0400 | [diff] [blame] | 877 | bool (*gui_idle)(struct radeon_device *rdev); |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 878 | /* power management */ |
Alex Deucher | 49e02b7 | 2010-04-23 17:57:27 -0400 | [diff] [blame] | 879 | void (*pm_misc)(struct radeon_device *rdev); |
| 880 | void (*pm_prepare)(struct radeon_device *rdev); |
| 881 | void (*pm_finish)(struct radeon_device *rdev); |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 882 | void (*pm_init_profile)(struct radeon_device *rdev); |
| 883 | void (*pm_get_dynpm_state)(struct radeon_device *rdev); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 884 | }; |
| 885 | |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 886 | /* |
| 887 | * Asic structures |
| 888 | */ |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 889 | struct r100_gpu_lockup { |
| 890 | unsigned long last_jiffies; |
| 891 | u32 last_cp_rptr; |
| 892 | }; |
| 893 | |
Dave Airlie | 551ebd8 | 2009-09-01 15:25:57 +1000 | [diff] [blame] | 894 | struct r100_asic { |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 895 | const unsigned *reg_safe_bm; |
| 896 | unsigned reg_safe_bm_size; |
| 897 | u32 hdp_cntl; |
| 898 | struct r100_gpu_lockup lockup; |
Dave Airlie | 551ebd8 | 2009-09-01 15:25:57 +1000 | [diff] [blame] | 899 | }; |
| 900 | |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 901 | struct r300_asic { |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 902 | const unsigned *reg_safe_bm; |
| 903 | unsigned reg_safe_bm_size; |
| 904 | u32 resync_scratch; |
| 905 | u32 hdp_cntl; |
| 906 | struct r100_gpu_lockup lockup; |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 907 | }; |
| 908 | |
| 909 | struct r600_asic { |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 910 | unsigned max_pipes; |
| 911 | unsigned max_tile_pipes; |
| 912 | unsigned max_simds; |
| 913 | unsigned max_backends; |
| 914 | unsigned max_gprs; |
| 915 | unsigned max_threads; |
| 916 | unsigned max_stack_entries; |
| 917 | unsigned max_hw_contexts; |
| 918 | unsigned max_gs_threads; |
| 919 | unsigned sx_max_export_size; |
| 920 | unsigned sx_max_export_pos_size; |
| 921 | unsigned sx_max_export_smx_size; |
| 922 | unsigned sq_num_cf_insts; |
| 923 | unsigned tiling_nbanks; |
| 924 | unsigned tiling_npipes; |
| 925 | unsigned tiling_group_size; |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 926 | unsigned tile_config; |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 927 | struct r100_gpu_lockup lockup; |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 928 | }; |
| 929 | |
| 930 | struct rv770_asic { |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 931 | unsigned max_pipes; |
| 932 | unsigned max_tile_pipes; |
| 933 | unsigned max_simds; |
| 934 | unsigned max_backends; |
| 935 | unsigned max_gprs; |
| 936 | unsigned max_threads; |
| 937 | unsigned max_stack_entries; |
| 938 | unsigned max_hw_contexts; |
| 939 | unsigned max_gs_threads; |
| 940 | unsigned sx_max_export_size; |
| 941 | unsigned sx_max_export_pos_size; |
| 942 | unsigned sx_max_export_smx_size; |
| 943 | unsigned sq_num_cf_insts; |
| 944 | unsigned sx_num_of_sets; |
| 945 | unsigned sc_prim_fifo_size; |
| 946 | unsigned sc_hiz_tile_fifo_size; |
| 947 | unsigned sc_earlyz_tile_fifo_fize; |
| 948 | unsigned tiling_nbanks; |
| 949 | unsigned tiling_npipes; |
| 950 | unsigned tiling_group_size; |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 951 | unsigned tile_config; |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 952 | struct r100_gpu_lockup lockup; |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 953 | }; |
| 954 | |
Alex Deucher | 32fcdbf | 2010-03-24 13:33:47 -0400 | [diff] [blame] | 955 | struct evergreen_asic { |
| 956 | unsigned num_ses; |
| 957 | unsigned max_pipes; |
| 958 | unsigned max_tile_pipes; |
| 959 | unsigned max_simds; |
| 960 | unsigned max_backends; |
| 961 | unsigned max_gprs; |
| 962 | unsigned max_threads; |
| 963 | unsigned max_stack_entries; |
| 964 | unsigned max_hw_contexts; |
| 965 | unsigned max_gs_threads; |
| 966 | unsigned sx_max_export_size; |
| 967 | unsigned sx_max_export_pos_size; |
| 968 | unsigned sx_max_export_smx_size; |
| 969 | unsigned sq_num_cf_insts; |
| 970 | unsigned sx_num_of_sets; |
| 971 | unsigned sc_prim_fifo_size; |
| 972 | unsigned sc_hiz_tile_fifo_size; |
| 973 | unsigned sc_earlyz_tile_fifo_size; |
| 974 | unsigned tiling_nbanks; |
| 975 | unsigned tiling_npipes; |
| 976 | unsigned tiling_group_size; |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 977 | unsigned tile_config; |
Alex Deucher | 32fcdbf | 2010-03-24 13:33:47 -0400 | [diff] [blame] | 978 | }; |
| 979 | |
Jerome Glisse | 068a117 | 2009-06-17 13:28:30 +0200 | [diff] [blame] | 980 | union radeon_asic_config { |
| 981 | struct r300_asic r300; |
Dave Airlie | 551ebd8 | 2009-09-01 15:25:57 +1000 | [diff] [blame] | 982 | struct r100_asic r100; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 983 | struct r600_asic r600; |
| 984 | struct rv770_asic rv770; |
Alex Deucher | 32fcdbf | 2010-03-24 13:33:47 -0400 | [diff] [blame] | 985 | struct evergreen_asic evergreen; |
Jerome Glisse | 068a117 | 2009-06-17 13:28:30 +0200 | [diff] [blame] | 986 | }; |
| 987 | |
Daniel Vetter | 0a10c85 | 2010-03-11 21:19:14 +0000 | [diff] [blame] | 988 | /* |
| 989 | * asic initizalization from radeon_asic.c |
| 990 | */ |
| 991 | void radeon_agp_disable(struct radeon_device *rdev); |
| 992 | int radeon_asic_init(struct radeon_device *rdev); |
| 993 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 994 | |
| 995 | /* |
| 996 | * IOCTL. |
| 997 | */ |
| 998 | int radeon_gem_info_ioctl(struct drm_device *dev, void *data, |
| 999 | struct drm_file *filp); |
| 1000 | int radeon_gem_create_ioctl(struct drm_device *dev, void *data, |
| 1001 | struct drm_file *filp); |
| 1002 | int radeon_gem_pin_ioctl(struct drm_device *dev, void *data, |
| 1003 | struct drm_file *file_priv); |
| 1004 | int radeon_gem_unpin_ioctl(struct drm_device *dev, void *data, |
| 1005 | struct drm_file *file_priv); |
| 1006 | int radeon_gem_pwrite_ioctl(struct drm_device *dev, void *data, |
| 1007 | struct drm_file *file_priv); |
| 1008 | int radeon_gem_pread_ioctl(struct drm_device *dev, void *data, |
| 1009 | struct drm_file *file_priv); |
| 1010 | int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, |
| 1011 | struct drm_file *filp); |
| 1012 | int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, |
| 1013 | struct drm_file *filp); |
| 1014 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
| 1015 | struct drm_file *filp); |
| 1016 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
| 1017 | struct drm_file *filp); |
| 1018 | int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 1019 | int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, |
| 1020 | struct drm_file *filp); |
| 1021 | int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, |
| 1022 | struct drm_file *filp); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1023 | |
Alex Deucher | 87cbf8f | 2010-08-27 13:59:54 -0400 | [diff] [blame] | 1024 | /* VRAM scratch page for HDP bug */ |
| 1025 | struct r700_vram_scratch { |
| 1026 | struct radeon_bo *robj; |
| 1027 | volatile uint32_t *ptr; |
| 1028 | }; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1029 | |
| 1030 | /* |
| 1031 | * Core structure, functions and helpers. |
| 1032 | */ |
| 1033 | typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t); |
| 1034 | typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t); |
| 1035 | |
| 1036 | struct radeon_device { |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1037 | struct device *dev; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1038 | struct drm_device *ddev; |
| 1039 | struct pci_dev *pdev; |
| 1040 | /* ASIC */ |
Jerome Glisse | 068a117 | 2009-06-17 13:28:30 +0200 | [diff] [blame] | 1041 | union radeon_asic_config config; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1042 | enum radeon_family family; |
| 1043 | unsigned long flags; |
| 1044 | int usec_timeout; |
| 1045 | enum radeon_pll_errata pll_errata; |
| 1046 | int num_gb_pipes; |
Alex Deucher | f779b3e | 2009-08-19 19:11:39 -0400 | [diff] [blame] | 1047 | int num_z_pipes; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1048 | int disp_priority; |
| 1049 | /* BIOS */ |
| 1050 | uint8_t *bios; |
| 1051 | bool is_atom_bios; |
| 1052 | uint16_t bios_header_start; |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 1053 | struct radeon_bo *stollen_vga_memory; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1054 | /* Register mmio */ |
Dave Airlie | 4c9bc75 | 2009-06-29 18:29:12 +1000 | [diff] [blame] | 1055 | resource_size_t rmmio_base; |
| 1056 | resource_size_t rmmio_size; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1057 | void *rmmio; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1058 | radeon_rreg_t mc_rreg; |
| 1059 | radeon_wreg_t mc_wreg; |
| 1060 | radeon_rreg_t pll_rreg; |
| 1061 | radeon_wreg_t pll_wreg; |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1062 | uint32_t pcie_reg_mask; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1063 | radeon_rreg_t pciep_rreg; |
| 1064 | radeon_wreg_t pciep_wreg; |
Alex Deucher | 351a52a | 2010-06-30 11:52:50 -0400 | [diff] [blame] | 1065 | /* io port */ |
| 1066 | void __iomem *rio_mem; |
| 1067 | resource_size_t rio_mem_size; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1068 | struct radeon_clock clock; |
| 1069 | struct radeon_mc mc; |
| 1070 | struct radeon_gart gart; |
| 1071 | struct radeon_mode_info mode_info; |
| 1072 | struct radeon_scratch scratch; |
| 1073 | struct radeon_mman mman; |
| 1074 | struct radeon_fence_driver fence_drv; |
| 1075 | struct radeon_cp cp; |
| 1076 | struct radeon_ib_pool ib_pool; |
| 1077 | struct radeon_irq irq; |
| 1078 | struct radeon_asic *asic; |
| 1079 | struct radeon_gem gem; |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 1080 | struct radeon_pm pm; |
Yang Zhao | f657c2a | 2009-09-15 12:21:01 +1000 | [diff] [blame] | 1081 | uint32_t bios_scratch[RADEON_BIOS_NUM_SCRATCH]; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1082 | struct mutex cs_mutex; |
| 1083 | struct radeon_wb wb; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1084 | struct radeon_dummy_page dummy_page; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1085 | bool gpu_lockup; |
| 1086 | bool shutdown; |
| 1087 | bool suspend; |
Dave Airlie | ad49f50 | 2009-07-10 22:36:26 +1000 | [diff] [blame] | 1088 | bool need_dma32; |
Jerome Glisse | 733289c | 2009-09-16 15:24:21 +0200 | [diff] [blame] | 1089 | bool accel_working; |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 1090 | struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES]; |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1091 | const struct firmware *me_fw; /* all family ME firmware */ |
| 1092 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 1093 | const struct firmware *rlc_fw; /* r6/700 RLC firmware */ |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1094 | struct r600_blit r600_blit; |
Alex Deucher | 87cbf8f | 2010-08-27 13:59:54 -0400 | [diff] [blame] | 1095 | struct r700_vram_scratch vram_scratch; |
Alex Deucher | 3e5cb98 | 2009-10-16 12:21:24 -0400 | [diff] [blame] | 1096 | int msi_enabled; /* msi enabled */ |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 1097 | struct r600_ih ih; /* r6/700 interrupt ring */ |
Alex Deucher | d4877cf | 2009-12-04 16:56:37 -0500 | [diff] [blame] | 1098 | struct workqueue_struct *wq; |
| 1099 | struct work_struct hotplug_work; |
Alex Deucher | 18917b6 | 2010-02-01 16:02:25 -0500 | [diff] [blame] | 1100 | int num_crtc; /* number of crtcs */ |
Alex Deucher | 40bacf1 | 2009-12-23 03:23:21 -0500 | [diff] [blame] | 1101 | struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ |
Matthew Garrett | 5876dd2 | 2010-04-26 15:52:20 -0400 | [diff] [blame] | 1102 | struct mutex vram_mutex; |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1103 | |
| 1104 | /* audio stuff */ |
Rafał Miłecki | 7eea7e9 | 2010-06-19 12:24:56 +0200 | [diff] [blame] | 1105 | bool audio_enabled; |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1106 | struct timer_list audio_timer; |
| 1107 | int audio_channels; |
| 1108 | int audio_rate; |
| 1109 | int audio_bits_per_sample; |
| 1110 | uint8_t audio_status_bits; |
| 1111 | uint8_t audio_category_code; |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 1112 | |
| 1113 | bool powered_down; |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 1114 | struct notifier_block acpi_nb; |
Dave Airlie | ab9e1f5 | 2010-07-13 11:11:11 +1000 | [diff] [blame] | 1115 | /* only one userspace can use Hyperz features at a time */ |
| 1116 | struct drm_file *hyperz_filp; |
Alex Deucher | f376b94 | 2010-08-05 21:21:16 -0400 | [diff] [blame] | 1117 | /* i2c buses */ |
| 1118 | struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS]; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1119 | }; |
| 1120 | |
| 1121 | int radeon_device_init(struct radeon_device *rdev, |
| 1122 | struct drm_device *ddev, |
| 1123 | struct pci_dev *pdev, |
| 1124 | uint32_t flags); |
| 1125 | void radeon_device_fini(struct radeon_device *rdev); |
| 1126 | int radeon_gpu_wait_for_idle(struct radeon_device *rdev); |
| 1127 | |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1128 | /* r600 blit */ |
| 1129 | int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes); |
| 1130 | void r600_blit_done_copy(struct radeon_device *rdev, struct radeon_fence *fence); |
| 1131 | void r600_kms_blit_copy(struct radeon_device *rdev, |
| 1132 | u64 src_gpu_addr, u64 dst_gpu_addr, |
| 1133 | int size_bytes); |
Alex Deucher | d7ccd8f | 2010-09-09 11:33:36 -0400 | [diff] [blame] | 1134 | /* evergreen blit */ |
| 1135 | int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes); |
| 1136 | void evergreen_blit_done_copy(struct radeon_device *rdev, struct radeon_fence *fence); |
| 1137 | void evergreen_kms_blit_copy(struct radeon_device *rdev, |
| 1138 | u64 src_gpu_addr, u64 dst_gpu_addr, |
| 1139 | int size_bytes); |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1140 | |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1141 | static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg) |
| 1142 | { |
Alex Deucher | 07bec2d | 2010-01-13 19:09:12 -0500 | [diff] [blame] | 1143 | if (reg < rdev->rmmio_size) |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1144 | return readl(((void __iomem *)rdev->rmmio) + reg); |
| 1145 | else { |
| 1146 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); |
| 1147 | return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 1152 | { |
Alex Deucher | 07bec2d | 2010-01-13 19:09:12 -0500 | [diff] [blame] | 1153 | if (reg < rdev->rmmio_size) |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1154 | writel(v, ((void __iomem *)rdev->rmmio) + reg); |
| 1155 | else { |
| 1156 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); |
| 1157 | writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); |
| 1158 | } |
| 1159 | } |
| 1160 | |
Alex Deucher | 351a52a | 2010-06-30 11:52:50 -0400 | [diff] [blame] | 1161 | static inline u32 r100_io_rreg(struct radeon_device *rdev, u32 reg) |
| 1162 | { |
| 1163 | if (reg < rdev->rio_mem_size) |
| 1164 | return ioread32(rdev->rio_mem + reg); |
| 1165 | else { |
| 1166 | iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX); |
| 1167 | return ioread32(rdev->rio_mem + RADEON_MM_DATA); |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | static inline void r100_io_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 1172 | { |
| 1173 | if (reg < rdev->rio_mem_size) |
| 1174 | iowrite32(v, rdev->rio_mem + reg); |
| 1175 | else { |
| 1176 | iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX); |
| 1177 | iowrite32(v, rdev->rio_mem + RADEON_MM_DATA); |
| 1178 | } |
| 1179 | } |
| 1180 | |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 1181 | /* |
| 1182 | * Cast helper |
| 1183 | */ |
| 1184 | #define to_radeon_fence(p) ((struct radeon_fence *)(p)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1185 | |
| 1186 | /* |
| 1187 | * Registers read & write functions. |
| 1188 | */ |
| 1189 | #define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg)) |
| 1190 | #define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg)) |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1191 | #define RREG32(reg) r100_mm_rreg(rdev, (reg)) |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1192 | #define DREG32(reg) printk(KERN_INFO "REGISTER: " #reg " : 0x%08X\n", r100_mm_rreg(rdev, (reg))) |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1193 | #define WREG32(reg, v) r100_mm_wreg(rdev, (reg), (v)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1194 | #define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) |
| 1195 | #define REG_GET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) |
| 1196 | #define RREG32_PLL(reg) rdev->pll_rreg(rdev, (reg)) |
| 1197 | #define WREG32_PLL(reg, v) rdev->pll_wreg(rdev, (reg), (v)) |
| 1198 | #define RREG32_MC(reg) rdev->mc_rreg(rdev, (reg)) |
| 1199 | #define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1200 | #define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg)) |
| 1201 | #define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v)) |
Rafał Miłecki | aa5120d | 2010-02-18 20:24:28 +0000 | [diff] [blame] | 1202 | #define RREG32_PCIE_P(reg) rdev->pciep_rreg(rdev, (reg)) |
| 1203 | #define WREG32_PCIE_P(reg, v) rdev->pciep_wreg(rdev, (reg), (v)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1204 | #define WREG32_P(reg, val, mask) \ |
| 1205 | do { \ |
| 1206 | uint32_t tmp_ = RREG32(reg); \ |
| 1207 | tmp_ &= (mask); \ |
| 1208 | tmp_ |= ((val) & ~(mask)); \ |
| 1209 | WREG32(reg, tmp_); \ |
| 1210 | } while (0) |
| 1211 | #define WREG32_PLL_P(reg, val, mask) \ |
| 1212 | do { \ |
| 1213 | uint32_t tmp_ = RREG32_PLL(reg); \ |
| 1214 | tmp_ &= (mask); \ |
| 1215 | tmp_ |= ((val) & ~(mask)); \ |
| 1216 | WREG32_PLL(reg, tmp_); \ |
| 1217 | } while (0) |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1218 | #define DREG32_SYS(sqf, rdev, reg) seq_printf((sqf), #reg " : 0x%08X\n", r100_mm_rreg((rdev), (reg))) |
Alex Deucher | 351a52a | 2010-06-30 11:52:50 -0400 | [diff] [blame] | 1219 | #define RREG32_IO(reg) r100_io_rreg(rdev, (reg)) |
| 1220 | #define WREG32_IO(reg, v) r100_io_wreg(rdev, (reg), (v)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1221 | |
Dave Airlie | de1b289 | 2009-08-12 18:43:14 +1000 | [diff] [blame] | 1222 | /* |
| 1223 | * Indirect registers accessor |
| 1224 | */ |
| 1225 | static inline uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg) |
| 1226 | { |
| 1227 | uint32_t r; |
| 1228 | |
| 1229 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); |
| 1230 | r = RREG32(RADEON_PCIE_DATA); |
| 1231 | return r; |
| 1232 | } |
| 1233 | |
| 1234 | static inline void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 1235 | { |
| 1236 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); |
| 1237 | WREG32(RADEON_PCIE_DATA, (v)); |
| 1238 | } |
| 1239 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1240 | void r100_pll_errata_after_index(struct radeon_device *rdev); |
| 1241 | |
| 1242 | |
| 1243 | /* |
| 1244 | * ASICs helpers. |
| 1245 | */ |
Dave Airlie | b995e43 | 2009-07-14 02:02:32 +1000 | [diff] [blame] | 1246 | #define ASIC_IS_RN50(rdev) ((rdev->pdev->device == 0x515e) || \ |
| 1247 | (rdev->pdev->device == 0x5969)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1248 | #define ASIC_IS_RV100(rdev) ((rdev->family == CHIP_RV100) || \ |
| 1249 | (rdev->family == CHIP_RV200) || \ |
| 1250 | (rdev->family == CHIP_RS100) || \ |
| 1251 | (rdev->family == CHIP_RS200) || \ |
| 1252 | (rdev->family == CHIP_RV250) || \ |
| 1253 | (rdev->family == CHIP_RV280) || \ |
| 1254 | (rdev->family == CHIP_RS300)) |
| 1255 | #define ASIC_IS_R300(rdev) ((rdev->family == CHIP_R300) || \ |
| 1256 | (rdev->family == CHIP_RV350) || \ |
| 1257 | (rdev->family == CHIP_R350) || \ |
| 1258 | (rdev->family == CHIP_RV380) || \ |
| 1259 | (rdev->family == CHIP_R420) || \ |
| 1260 | (rdev->family == CHIP_R423) || \ |
| 1261 | (rdev->family == CHIP_RV410) || \ |
| 1262 | (rdev->family == CHIP_RS400) || \ |
| 1263 | (rdev->family == CHIP_RS480)) |
| 1264 | #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) |
| 1265 | #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) |
| 1266 | #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) |
Alex Deucher | bcc1c2a | 2010-01-12 17:54:34 -0500 | [diff] [blame] | 1267 | #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1268 | |
| 1269 | /* |
| 1270 | * BIOS helpers. |
| 1271 | */ |
| 1272 | #define RBIOS8(i) (rdev->bios[i]) |
| 1273 | #define RBIOS16(i) (RBIOS8(i) | (RBIOS8((i)+1) << 8)) |
| 1274 | #define RBIOS32(i) ((RBIOS16(i)) | (RBIOS16((i)+2) << 16)) |
| 1275 | |
| 1276 | int radeon_combios_init(struct radeon_device *rdev); |
| 1277 | void radeon_combios_fini(struct radeon_device *rdev); |
| 1278 | int radeon_atombios_init(struct radeon_device *rdev); |
| 1279 | void radeon_atombios_fini(struct radeon_device *rdev); |
| 1280 | |
| 1281 | |
| 1282 | /* |
| 1283 | * RING helpers. |
| 1284 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1285 | static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) |
| 1286 | { |
| 1287 | #if DRM_DEBUG_CODE |
| 1288 | if (rdev->cp.count_dw <= 0) { |
| 1289 | DRM_ERROR("radeon: writting more dword to ring than expected !\n"); |
| 1290 | } |
| 1291 | #endif |
| 1292 | rdev->cp.ring[rdev->cp.wptr++] = v; |
| 1293 | rdev->cp.wptr &= rdev->cp.ptr_mask; |
| 1294 | rdev->cp.count_dw--; |
| 1295 | rdev->cp.ring_free_dw--; |
| 1296 | } |
| 1297 | |
| 1298 | |
| 1299 | /* |
| 1300 | * ASICs macro. |
| 1301 | */ |
Jerome Glisse | 068a117 | 2009-06-17 13:28:30 +0200 | [diff] [blame] | 1302 | #define radeon_init(rdev) (rdev)->asic->init((rdev)) |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1303 | #define radeon_fini(rdev) (rdev)->asic->fini((rdev)) |
| 1304 | #define radeon_resume(rdev) (rdev)->asic->resume((rdev)) |
| 1305 | #define radeon_suspend(rdev) (rdev)->asic->suspend((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1306 | #define radeon_cs_parse(p) rdev->asic->cs_parse((p)) |
Dave Airlie | 28d5204 | 2009-09-21 14:33:58 +1000 | [diff] [blame] | 1307 | #define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state)) |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 1308 | #define radeon_gpu_is_lockup(rdev) (rdev)->asic->gpu_is_lockup((rdev)) |
Jerome Glisse | a2d07b7 | 2010-03-09 14:45:11 +0000 | [diff] [blame] | 1309 | #define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1310 | #define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart_tlb_flush((rdev)) |
| 1311 | #define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart_set_page((rdev), (i), (p)) |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1312 | #define radeon_cp_commit(rdev) (rdev)->asic->cp_commit((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1313 | #define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev)) |
Jerome Glisse | 3ce0a23 | 2009-09-08 10:10:24 +1000 | [diff] [blame] | 1314 | #define radeon_ring_test(rdev) (rdev)->asic->ring_test((rdev)) |
| 1315 | #define radeon_ring_ib_execute(rdev, ib) (rdev)->asic->ring_ib_execute((rdev), (ib)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1316 | #define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev)) |
| 1317 | #define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev)) |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 1318 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->get_vblank_counter((rdev), (crtc)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1319 | #define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence)) |
| 1320 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) |
| 1321 | #define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) |
| 1322 | #define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy((rdev), (s), (d), (np), (f)) |
Rafał Miłecki | 7433874 | 2009-11-03 00:53:02 +0100 | [diff] [blame] | 1323 | #define radeon_get_engine_clock(rdev) (rdev)->asic->get_engine_clock((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1324 | #define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) |
Rafał Miłecki | 7433874 | 2009-11-03 00:53:02 +0100 | [diff] [blame] | 1325 | #define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev)) |
Rafał Miłecki | 93e7de7 | 2009-11-04 23:34:10 +0100 | [diff] [blame] | 1326 | #define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_memory_clock((rdev), (e)) |
Alex Deucher | c836a41 | 2009-12-23 10:07:50 -0500 | [diff] [blame] | 1327 | #define radeon_get_pcie_lanes(rdev) (rdev)->asic->get_pcie_lanes((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1328 | #define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l)) |
| 1329 | #define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e)) |
Dave Airlie | e024e11 | 2009-06-24 09:48:08 +1000 | [diff] [blame] | 1330 | #define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) |
| 1331 | #define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) |
Jerome Glisse | c93bb85 | 2009-07-13 21:04:08 +0200 | [diff] [blame] | 1332 | #define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) |
Alex Deucher | 429770b | 2009-12-04 15:26:55 -0500 | [diff] [blame] | 1333 | #define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) |
| 1334 | #define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) |
| 1335 | #define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) |
| 1336 | #define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd)) |
Alex Deucher | def9ba9 | 2010-04-22 12:39:58 -0400 | [diff] [blame] | 1337 | #define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev)) |
Alex Deucher | a424816 | 2010-04-24 14:50:23 -0400 | [diff] [blame] | 1338 | #define radeon_pm_misc(rdev) (rdev)->asic->pm_misc((rdev)) |
| 1339 | #define radeon_pm_prepare(rdev) (rdev)->asic->pm_prepare((rdev)) |
| 1340 | #define radeon_pm_finish(rdev) (rdev)->asic->pm_finish((rdev)) |
Alex Deucher | ce8f537 | 2010-05-07 15:10:16 -0400 | [diff] [blame] | 1341 | #define radeon_pm_init_profile(rdev) (rdev)->asic->pm_init_profile((rdev)) |
| 1342 | #define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm_get_dynpm_state((rdev)) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1343 | |
Jerome Glisse | 6cf8a3f | 2009-09-10 21:46:48 +0200 | [diff] [blame] | 1344 | /* Common functions */ |
Jerome Glisse | 700a0cc | 2010-01-13 15:16:38 +0100 | [diff] [blame] | 1345 | /* AGP */ |
Jerome Glisse | 90aca4d | 2010-03-09 14:45:12 +0000 | [diff] [blame] | 1346 | extern int radeon_gpu_reset(struct radeon_device *rdev); |
Jerome Glisse | 700a0cc | 2010-01-13 15:16:38 +0100 | [diff] [blame] | 1347 | extern void radeon_agp_disable(struct radeon_device *rdev); |
Jerome Glisse | 4aac047 | 2009-09-14 18:29:49 +0200 | [diff] [blame] | 1348 | extern int radeon_gart_table_vram_pin(struct radeon_device *rdev); |
Dave Airlie | 8256856 | 2010-02-05 16:00:07 +1000 | [diff] [blame] | 1349 | extern void radeon_gart_restore(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1350 | extern int radeon_modeset_init(struct radeon_device *rdev); |
| 1351 | extern void radeon_modeset_fini(struct radeon_device *rdev); |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1352 | extern bool radeon_card_posted(struct radeon_device *rdev); |
Alex Deucher | f47299c | 2010-03-16 20:54:38 -0400 | [diff] [blame] | 1353 | extern void radeon_update_bandwidth_info(struct radeon_device *rdev); |
Alex Deucher | f46c012 | 2010-03-31 00:33:27 -0400 | [diff] [blame] | 1354 | extern void radeon_update_display_priority(struct radeon_device *rdev); |
Dave Airlie | 72542d7 | 2009-12-01 14:06:31 +1000 | [diff] [blame] | 1355 | extern bool radeon_boot_test_post_card(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1356 | extern void radeon_scratch_init(struct radeon_device *rdev); |
Alex Deucher | 724c80e | 2010-08-27 18:25:25 -0400 | [diff] [blame] | 1357 | extern void radeon_wb_fini(struct radeon_device *rdev); |
| 1358 | extern int radeon_wb_init(struct radeon_device *rdev); |
| 1359 | extern void radeon_wb_disable(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1360 | extern void radeon_surface_init(struct radeon_device *rdev); |
| 1361 | extern int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data); |
Jerome Glisse | ca6ffc6 | 2009-10-01 10:20:52 +0200 | [diff] [blame] | 1362 | extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); |
Jerome Glisse | d39c3b8 | 2009-09-28 18:34:43 +0200 | [diff] [blame] | 1363 | extern void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); |
Jerome Glisse | 312ea8d | 2009-12-07 15:52:58 +0100 | [diff] [blame] | 1364 | extern void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain); |
Jerome Glisse | d03d858 | 2009-12-14 21:02:09 +0100 | [diff] [blame] | 1365 | extern bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo); |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 1366 | extern void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base); |
| 1367 | extern void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 1368 | extern int radeon_resume_kms(struct drm_device *dev); |
| 1369 | extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state); |
Jerome Glisse | 6cf8a3f | 2009-09-10 21:46:48 +0200 | [diff] [blame] | 1370 | |
Jerome Glisse | a18d7ea | 2009-09-09 22:23:27 +0200 | [diff] [blame] | 1371 | /* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ |
Jerome Glisse | 225758d | 2010-03-09 14:45:10 +0000 | [diff] [blame] | 1372 | extern void r100_gpu_lockup_update(struct r100_gpu_lockup *lockup, struct radeon_cp *cp); |
| 1373 | extern bool r100_gpu_cp_is_lockup(struct radeon_device *rdev, struct r100_gpu_lockup *lockup, struct radeon_cp *cp); |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1374 | |
Jerome Glisse | d455090 | 2009-10-01 10:12:06 +0200 | [diff] [blame] | 1375 | /* rv200,rv250,rv280 */ |
| 1376 | extern void r200_set_safe_registers(struct radeon_device *rdev); |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1377 | |
| 1378 | /* r300,r350,rv350,rv370,rv380 */ |
| 1379 | extern void r300_set_reg_safe(struct radeon_device *rdev); |
| 1380 | extern void r300_mc_program(struct radeon_device *rdev); |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 1381 | extern void r300_mc_init(struct radeon_device *rdev); |
Jerome Glisse | ca6ffc6 | 2009-10-01 10:20:52 +0200 | [diff] [blame] | 1382 | extern void r300_clock_startup(struct radeon_device *rdev); |
| 1383 | extern int r300_mc_wait_for_idle(struct radeon_device *rdev); |
Jerome Glisse | 4aac047 | 2009-09-14 18:29:49 +0200 | [diff] [blame] | 1384 | extern int rv370_pcie_gart_init(struct radeon_device *rdev); |
| 1385 | extern void rv370_pcie_gart_fini(struct radeon_device *rdev); |
| 1386 | extern int rv370_pcie_gart_enable(struct radeon_device *rdev); |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1387 | extern void rv370_pcie_gart_disable(struct radeon_device *rdev); |
Jerome Glisse | a18d7ea | 2009-09-09 22:23:27 +0200 | [diff] [blame] | 1388 | |
Jerome Glisse | 905b682 | 2009-09-09 22:24:20 +0200 | [diff] [blame] | 1389 | /* r420,r423,rv410 */ |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1390 | extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg); |
| 1391 | extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v); |
Jerome Glisse | 9f022dd | 2009-09-11 15:35:22 +0200 | [diff] [blame] | 1392 | extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev); |
Jerome Glisse | d39c3b8 | 2009-09-28 18:34:43 +0200 | [diff] [blame] | 1393 | extern void r420_pipes_init(struct radeon_device *rdev); |
Jerome Glisse | 905b682 | 2009-09-09 22:24:20 +0200 | [diff] [blame] | 1394 | |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1395 | /* rv515 */ |
Jerome Glisse | d39c3b8 | 2009-09-28 18:34:43 +0200 | [diff] [blame] | 1396 | struct rv515_mc_save { |
| 1397 | u32 d1vga_control; |
| 1398 | u32 d2vga_control; |
| 1399 | u32 vga_render_control; |
| 1400 | u32 vga_hdp_control; |
| 1401 | u32 d1crtc_control; |
| 1402 | u32 d2crtc_control; |
| 1403 | }; |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1404 | extern void rv515_bandwidth_avivo_update(struct radeon_device *rdev); |
Jerome Glisse | d39c3b8 | 2009-09-28 18:34:43 +0200 | [diff] [blame] | 1405 | extern void rv515_vga_render_disable(struct radeon_device *rdev); |
| 1406 | extern void rv515_set_safe_registers(struct radeon_device *rdev); |
Jerome Glisse | f0ed1f6 | 2009-09-28 20:39:19 +0200 | [diff] [blame] | 1407 | extern void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save); |
| 1408 | extern void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save); |
| 1409 | extern void rv515_clock_startup(struct radeon_device *rdev); |
| 1410 | extern void rv515_debugfs(struct radeon_device *rdev); |
| 1411 | extern int rv515_suspend(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1412 | |
Jerome Glisse | 3bc6853 | 2009-10-01 09:39:24 +0200 | [diff] [blame] | 1413 | /* rs400 */ |
| 1414 | extern int rs400_gart_init(struct radeon_device *rdev); |
| 1415 | extern int rs400_gart_enable(struct radeon_device *rdev); |
| 1416 | extern void rs400_gart_adjust_size(struct radeon_device *rdev); |
| 1417 | extern void rs400_gart_disable(struct radeon_device *rdev); |
| 1418 | extern void rs400_gart_fini(struct radeon_device *rdev); |
| 1419 | |
| 1420 | /* rs600 */ |
| 1421 | extern void rs600_set_safe_registers(struct radeon_device *rdev); |
Jerome Glisse | ac447df | 2009-09-30 22:18:43 +0200 | [diff] [blame] | 1422 | extern int rs600_irq_set(struct radeon_device *rdev); |
| 1423 | extern void rs600_irq_disable(struct radeon_device *rdev); |
Jerome Glisse | 3bc6853 | 2009-10-01 09:39:24 +0200 | [diff] [blame] | 1424 | |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1425 | /* rs690, rs740 */ |
| 1426 | extern void rs690_line_buffer_adjust(struct radeon_device *rdev, |
| 1427 | struct drm_display_mode *mode1, |
| 1428 | struct drm_display_mode *mode2); |
| 1429 | |
| 1430 | /* r600, rv610, rv630, rv620, rv635, rv670, rs780, rs880 */ |
Jerome Glisse | d594e46 | 2010-02-17 21:54:29 +0000 | [diff] [blame] | 1431 | extern void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1432 | extern bool r600_card_posted(struct radeon_device *rdev); |
| 1433 | extern void r600_cp_stop(struct radeon_device *rdev); |
Alex Deucher | fe251e2 | 2010-03-24 13:36:43 -0400 | [diff] [blame] | 1434 | extern int r600_cp_start(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1435 | extern void r600_ring_init(struct radeon_device *rdev, unsigned ring_size); |
| 1436 | extern int r600_cp_resume(struct radeon_device *rdev); |
Jerome Glisse | 655efd3 | 2010-02-02 11:51:45 +0100 | [diff] [blame] | 1437 | extern void r600_cp_fini(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1438 | extern int r600_count_pipe_bits(uint32_t val); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1439 | extern int r600_mc_wait_for_idle(struct radeon_device *rdev); |
Jerome Glisse | 4aac047 | 2009-09-14 18:29:49 +0200 | [diff] [blame] | 1440 | extern int r600_pcie_gart_init(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1441 | extern void r600_pcie_gart_tlb_flush(struct radeon_device *rdev); |
| 1442 | extern int r600_ib_test(struct radeon_device *rdev); |
| 1443 | extern int r600_ring_test(struct radeon_device *rdev); |
Jerome Glisse | 21f9a43 | 2009-09-11 15:55:33 +0200 | [diff] [blame] | 1444 | extern void r600_scratch_init(struct radeon_device *rdev); |
| 1445 | extern int r600_blit_init(struct radeon_device *rdev); |
| 1446 | extern void r600_blit_fini(struct radeon_device *rdev); |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 1447 | extern int r600_init_microcode(struct radeon_device *rdev); |
Jerome Glisse | a2d07b7 | 2010-03-09 14:45:11 +0000 | [diff] [blame] | 1448 | extern int r600_asic_reset(struct radeon_device *rdev); |
Alex Deucher | d8f60cf | 2009-12-01 13:43:46 -0500 | [diff] [blame] | 1449 | /* r600 irq */ |
| 1450 | extern int r600_irq_init(struct radeon_device *rdev); |
| 1451 | extern void r600_irq_fini(struct radeon_device *rdev); |
| 1452 | extern void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size); |
| 1453 | extern int r600_irq_set(struct radeon_device *rdev); |
Jerome Glisse | 0c45249 | 2010-01-15 14:44:37 +0100 | [diff] [blame] | 1454 | extern void r600_irq_suspend(struct radeon_device *rdev); |
Alex Deucher | 45f9a39 | 2010-03-24 13:55:51 -0400 | [diff] [blame] | 1455 | extern void r600_disable_interrupts(struct radeon_device *rdev); |
| 1456 | extern void r600_rlc_stop(struct radeon_device *rdev); |
Jerome Glisse | 0c45249 | 2010-01-15 14:44:37 +0100 | [diff] [blame] | 1457 | /* r600 audio */ |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1458 | extern int r600_audio_init(struct radeon_device *rdev); |
| 1459 | extern int r600_audio_tmds_index(struct drm_encoder *encoder); |
| 1460 | extern void r600_audio_set_clock(struct drm_encoder *encoder, int clock); |
Christian König | 58bd086 | 2010-04-05 22:14:55 +0200 | [diff] [blame] | 1461 | extern int r600_audio_channels(struct radeon_device *rdev); |
| 1462 | extern int r600_audio_bits_per_sample(struct radeon_device *rdev); |
| 1463 | extern int r600_audio_rate(struct radeon_device *rdev); |
| 1464 | extern uint8_t r600_audio_status_bits(struct radeon_device *rdev); |
| 1465 | extern uint8_t r600_audio_category_code(struct radeon_device *rdev); |
Christian Koenig | f259493 | 2010-04-10 03:13:16 +0200 | [diff] [blame] | 1466 | extern void r600_audio_schedule_polling(struct radeon_device *rdev); |
Christian König | 58bd086 | 2010-04-05 22:14:55 +0200 | [diff] [blame] | 1467 | extern void r600_audio_enable_polling(struct drm_encoder *encoder); |
| 1468 | extern void r600_audio_disable_polling(struct drm_encoder *encoder); |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1469 | extern void r600_audio_fini(struct radeon_device *rdev); |
| 1470 | extern void r600_hdmi_init(struct drm_encoder *encoder); |
Rafał Miłecki | 2cd6218c | 2010-03-08 22:14:01 +0000 | [diff] [blame] | 1471 | extern void r600_hdmi_enable(struct drm_encoder *encoder); |
| 1472 | extern void r600_hdmi_disable(struct drm_encoder *encoder); |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1473 | extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); |
| 1474 | extern int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder); |
Christian König | 58bd086 | 2010-04-05 22:14:55 +0200 | [diff] [blame] | 1475 | extern void r600_hdmi_update_audio_settings(struct drm_encoder *encoder); |
Christian Koenig | dafc3bd | 2009-10-11 23:49:13 +0200 | [diff] [blame] | 1476 | |
Alex Deucher | fe251e2 | 2010-03-24 13:36:43 -0400 | [diff] [blame] | 1477 | extern void r700_cp_stop(struct radeon_device *rdev); |
| 1478 | extern void r700_cp_fini(struct radeon_device *rdev); |
Alex Deucher | 0ca2ab5 | 2010-02-26 13:57:45 -0500 | [diff] [blame] | 1479 | extern void evergreen_disable_interrupt_state(struct radeon_device *rdev); |
| 1480 | extern int evergreen_irq_set(struct radeon_device *rdev); |
Alex Deucher | d7ccd8f | 2010-09-09 11:33:36 -0400 | [diff] [blame] | 1481 | extern int evergreen_blit_init(struct radeon_device *rdev); |
| 1482 | extern void evergreen_blit_fini(struct radeon_device *rdev); |
Alex Deucher | fe251e2 | 2010-03-24 13:36:43 -0400 | [diff] [blame] | 1483 | |
Alberto Milone | d7a2952 | 2010-07-06 11:40:24 -0400 | [diff] [blame] | 1484 | /* radeon_acpi.c */ |
| 1485 | #if defined(CONFIG_ACPI) |
| 1486 | extern int radeon_acpi_init(struct radeon_device *rdev); |
| 1487 | #else |
| 1488 | static inline int radeon_acpi_init(struct radeon_device *rdev) { return 0; } |
| 1489 | #endif |
| 1490 | |
Alex Deucher | bcc1c2a | 2010-01-12 17:54:34 -0500 | [diff] [blame] | 1491 | /* evergreen */ |
| 1492 | struct evergreen_mc_save { |
| 1493 | u32 vga_control[6]; |
| 1494 | u32 vga_render_control; |
| 1495 | u32 vga_hdp_control; |
| 1496 | u32 crtc_control[6]; |
| 1497 | }; |
| 1498 | |
Jerome Glisse | 4c78867 | 2009-11-20 14:29:23 +0100 | [diff] [blame] | 1499 | #include "radeon_object.h" |
| 1500 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1501 | #endif |