Rev 3764 | Rev 5097 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3764 | Rev 5078 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include "display.h" |
38 | #include "display.h" |
Line 39... | Line 39... | ||
39 | 39 | ||
Line -... | Line 40... | ||
- | 40 | ||
- | 41 | #include |
|
Line 40... | Line 42... | ||
40 | 42 | ||
41 | #include |
43 | #define PCI_VENDOR_ID_ATI 0x1002 |
42 | 44 | #define PCI_VENDOR_ID_APPLE 0x106b |
|
43 | 45 | ||
44 | int radeon_no_wb = 1; |
46 | int radeon_no_wb; |
45 | int radeon_modeset = -1; |
47 | int radeon_modeset = -1; |
46 | int radeon_dynclks = -1; |
48 | int radeon_dynclks = -1; |
47 | int radeon_r4xx_atom = 0; |
49 | int radeon_r4xx_atom = 0; |
48 | int radeon_agpmode = 0; |
50 | int radeon_agpmode = 0; |
49 | int radeon_vram_limit = 0; |
51 | int radeon_vram_limit = 0; |
50 | int radeon_gart_size = 512; /* default gart size */ |
52 | int radeon_gart_size = -1; /* auto */ |
51 | int radeon_benchmarking = 0; |
- | |
52 | int radeon_testing = 0; |
- | |
53 | int radeon_connector_table = 0; |
53 | int radeon_benchmarking = 0; |
54 | int radeon_tv = 1; |
- | |
55 | int radeon_new_pll = -1; |
- | |
56 | int radeon_dynpm = -1; |
54 | int radeon_testing = 0; |
- | 55 | int radeon_connector_table = 0; |
|
- | 56 | int radeon_tv = 1; |
|
- | 57 | int radeon_audio = -1; |
|
57 | int radeon_audio = 1; |
58 | int radeon_disp_priority = 0; |
58 | int radeon_hw_i2c = 0; |
59 | int radeon_hw_i2c = 0; |
- | 60 | int radeon_pcie_gen2 = -1; |
|
- | 61 | int radeon_msi = -1; |
|
- | 62 | int radeon_lockup_timeout = 10000; |
|
- | 63 | int radeon_fastfb = 0; |
|
- | 64 | int radeon_dpm = -1; |
|
- | 65 | int radeon_aspm = -1; |
|
59 | int radeon_pcie_gen2 = 0; |
- | |
- | 66 | int radeon_runtime_pm = -1; |
|
- | 67 | int radeon_hard_reset = 0; |
|
60 | int radeon_disp_priority = 0; |
68 | int radeon_vm_size = 8; |
- | 69 | int radeon_vm_block_size = -1; |
|
Line 61... | Line 70... | ||
61 | int radeon_lockup_timeout = 10000; |
70 | int radeon_deep_color = 0; |
62 | int radeon_fastfb = 0; |
71 | int radeon_use_pflipirq = 2; |
- | 72 | int irq_override = 0; |
|
Line 63... | Line 73... | ||
63 | 73 | int radeon_bapm = -1; |
|
64 | int irq_override = 0; |
74 | |
65 | 75 | ||
Line 66... | Line 76... | ||
66 | 76 | extern display_t *os_display; |
|
67 | extern display_t *rdisplay; |
77 | extern struct drm_device *main_device; |
68 | struct drm_device *main_drm_device; |
78 | extern videomode_t usermode; |
Line 143... | Line 153... | ||
143 | "TAHITI", |
153 | "TAHITI", |
144 | "PITCAIRN", |
154 | "PITCAIRN", |
145 | "VERDE", |
155 | "VERDE", |
146 | "OLAND", |
156 | "OLAND", |
147 | "HAINAN", |
157 | "HAINAN", |
- | 158 | "BONAIRE", |
|
- | 159 | "KAVERI", |
|
- | 160 | "KABINI", |
|
- | 161 | "HAWAII", |
|
- | 162 | "MULLINS", |
|
148 | "LAST", |
163 | "LAST", |
149 | }; |
164 | }; |
Line -... | Line 165... | ||
- | 165 | ||
- | 166 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) |
|
- | 167 | #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1) |
|
- | 168 | ||
- | 169 | struct radeon_px_quirk { |
|
- | 170 | u32 chip_vendor; |
|
- | 171 | u32 chip_device; |
|
- | 172 | u32 subsys_vendor; |
|
- | 173 | u32 subsys_device; |
|
- | 174 | u32 px_quirk_flags; |
|
- | 175 | }; |
|
- | 176 | ||
- | 177 | static struct radeon_px_quirk radeon_px_quirk_list[] = { |
|
- | 178 | /* Acer aspire 5560g (CPU: AMD A4-3305M; GPU: AMD Radeon HD 6480g + 7470m) |
|
- | 179 | * https://bugzilla.kernel.org/show_bug.cgi?id=74551 |
|
- | 180 | */ |
|
- | 181 | { PCI_VENDOR_ID_ATI, 0x6760, 0x1025, 0x0672, RADEON_PX_QUIRK_DISABLE_PX }, |
|
- | 182 | /* Asus K73TA laptop with AMD A6-3400M APU and Radeon 6550 GPU |
|
- | 183 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
|
- | 184 | */ |
|
- | 185 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, |
|
- | 186 | /* macbook pro 8.2 */ |
|
- | 187 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
|
- | 188 | { 0, 0, 0, 0, 0 }, |
|
- | 189 | }; |
|
- | 190 | ||
- | 191 | bool radeon_is_px(struct drm_device *dev) |
|
- | 192 | { |
|
- | 193 | struct radeon_device *rdev = dev->dev_private; |
|
- | 194 | ||
- | 195 | if (rdev->flags & RADEON_IS_PX) |
|
- | 196 | return true; |
|
- | 197 | return false; |
|
- | 198 | } |
|
- | 199 | ||
- | 200 | static void radeon_device_handle_px_quirks(struct radeon_device *rdev) |
|
- | 201 | { |
|
- | 202 | struct radeon_px_quirk *p = radeon_px_quirk_list; |
|
- | 203 | ||
- | 204 | /* Apply PX quirks */ |
|
- | 205 | while (p && p->chip_device != 0) { |
|
- | 206 | if (rdev->pdev->vendor == p->chip_vendor && |
|
- | 207 | rdev->pdev->device == p->chip_device && |
|
- | 208 | rdev->pdev->subsystem_vendor == p->subsys_vendor && |
|
- | 209 | rdev->pdev->subsystem_device == p->subsys_device) { |
|
- | 210 | rdev->px_quirk_flags = p->px_quirk_flags; |
|
- | 211 | break; |
|
- | 212 | } |
|
- | 213 | ++p; |
|
- | 214 | } |
|
- | 215 | ||
- | 216 | if (rdev->px_quirk_flags & RADEON_PX_QUIRK_DISABLE_PX) |
|
- | 217 | rdev->flags &= ~RADEON_IS_PX; |
|
- | 218 | } |
|
150 | 219 | ||
151 | /** |
220 | /** |
152 | * radeon_program_register_sequence - program an array of registers. |
221 | * radeon_program_register_sequence - program an array of registers. |
153 | * |
222 | * |
154 | * @rdev: radeon_device pointer |
223 | * @rdev: radeon_device pointer |
Line 182... | Line 251... | ||
182 | } |
251 | } |
183 | WREG32(reg, tmp); |
252 | WREG32(reg, tmp); |
184 | } |
253 | } |
185 | } |
254 | } |
Line -... | Line 255... | ||
- | 255 | ||
- | 256 | void radeon_pci_config_reset(struct radeon_device *rdev) |
|
- | 257 | { |
|
- | 258 | pci_write_config_dword(rdev->pdev, 0x7c, RADEON_ASIC_RESET_DATA); |
|
- | 259 | } |
|
186 | 260 | ||
187 | /** |
261 | /** |
188 | * radeon_surface_init - Clear GPU surface registers. |
262 | * radeon_surface_init - Clear GPU surface registers. |
189 | * |
263 | * |
190 | * @rdev: radeon_device pointer |
264 | * @rdev: radeon_device pointer |
Line 196... | Line 270... | ||
196 | /* FIXME: check this out */ |
270 | /* FIXME: check this out */ |
197 | if (rdev->family < CHIP_R600) { |
271 | if (rdev->family < CHIP_R600) { |
198 | int i; |
272 | int i; |
Line 199... | Line 273... | ||
199 | 273 | ||
- | 274 | for (i = 0; i < RADEON_GEM_MAX_SURFACES; i++) { |
|
- | 275 | if (rdev->surface_regs[i].bo) |
|
- | 276 | radeon_bo_get_surface_reg(rdev->surface_regs[i].bo); |
|
200 | for (i = 0; i < RADEON_GEM_MAX_SURFACES; i++) { |
277 | else |
201 | radeon_clear_surface_reg(rdev, i); |
278 | radeon_clear_surface_reg(rdev, i); |
202 | } |
279 | } |
203 | /* enable surfaces */ |
280 | /* enable surfaces */ |
204 | WREG32(RADEON_SURFACE_CNTL, 0); |
281 | WREG32(RADEON_SURFACE_CNTL, 0); |
Line 274... | Line 351... | ||
274 | } |
351 | } |
275 | } |
352 | } |
276 | } |
353 | } |
Line 277... | Line 354... | ||
277 | 354 | ||
- | 355 | /* |
|
- | 356 | * GPU doorbell aperture helpers function. |
|
- | 357 | */ |
|
- | 358 | /** |
|
- | 359 | * radeon_doorbell_init - Init doorbell driver information. |
|
- | 360 | * |
|
- | 361 | * @rdev: radeon_device pointer |
|
- | 362 | * |
|
- | 363 | * Init doorbell driver information (CIK) |
|
- | 364 | * Returns 0 on success, error on failure. |
|
- | 365 | */ |
|
- | 366 | static int radeon_doorbell_init(struct radeon_device *rdev) |
|
- | 367 | { |
|
- | 368 | /* doorbell bar mapping */ |
|
- | 369 | rdev->doorbell.base = pci_resource_start(rdev->pdev, 2); |
|
- | 370 | rdev->doorbell.size = pci_resource_len(rdev->pdev, 2); |
|
- | 371 | ||
- | 372 | rdev->doorbell.num_doorbells = min_t(u32, rdev->doorbell.size / sizeof(u32), RADEON_MAX_DOORBELLS); |
|
- | 373 | if (rdev->doorbell.num_doorbells == 0) |
|
- | 374 | return -EINVAL; |
|
- | 375 | ||
- | 376 | rdev->doorbell.ptr = ioremap(rdev->doorbell.base, rdev->doorbell.num_doorbells * sizeof(u32)); |
|
- | 377 | if (rdev->doorbell.ptr == NULL) { |
|
- | 378 | return -ENOMEM; |
|
- | 379 | } |
|
- | 380 | DRM_INFO("doorbell mmio base: 0x%08X\n", (uint32_t)rdev->doorbell.base); |
|
- | 381 | DRM_INFO("doorbell mmio size: %u\n", (unsigned)rdev->doorbell.size); |
|
- | 382 | ||
- | 383 | memset(&rdev->doorbell.used, 0, sizeof(rdev->doorbell.used)); |
|
- | 384 | ||
- | 385 | return 0; |
|
- | 386 | } |
|
- | 387 | ||
- | 388 | /** |
|
- | 389 | * radeon_doorbell_fini - Tear down doorbell driver information. |
|
- | 390 | * |
|
- | 391 | * @rdev: radeon_device pointer |
|
- | 392 | * |
|
- | 393 | * Tear down doorbell driver information (CIK) |
|
- | 394 | */ |
|
- | 395 | static void radeon_doorbell_fini(struct radeon_device *rdev) |
|
- | 396 | { |
|
- | 397 | iounmap(rdev->doorbell.ptr); |
|
- | 398 | rdev->doorbell.ptr = NULL; |
|
- | 399 | } |
|
- | 400 | ||
- | 401 | /** |
|
- | 402 | * radeon_doorbell_get - Allocate a doorbell entry |
|
- | 403 | * |
|
- | 404 | * @rdev: radeon_device pointer |
|
- | 405 | * @doorbell: doorbell index |
|
- | 406 | * |
|
- | 407 | * Allocate a doorbell for use by the driver (all asics). |
|
- | 408 | * Returns 0 on success or -EINVAL on failure. |
|
- | 409 | */ |
|
- | 410 | int radeon_doorbell_get(struct radeon_device *rdev, u32 *doorbell) |
|
- | 411 | { |
|
- | 412 | unsigned long offset = find_first_zero_bit(rdev->doorbell.used, rdev->doorbell.num_doorbells); |
|
- | 413 | if (offset < rdev->doorbell.num_doorbells) { |
|
- | 414 | __set_bit(offset, rdev->doorbell.used); |
|
- | 415 | *doorbell = offset; |
|
- | 416 | return 0; |
|
- | 417 | } else { |
|
- | 418 | return -EINVAL; |
|
- | 419 | } |
|
- | 420 | } |
|
- | 421 | ||
- | 422 | /** |
|
- | 423 | * radeon_doorbell_free - Free a doorbell entry |
|
- | 424 | * |
|
- | 425 | * @rdev: radeon_device pointer |
|
- | 426 | * @doorbell: doorbell index |
|
- | 427 | * |
|
- | 428 | * Free a doorbell allocated for use by the driver (all asics) |
|
- | 429 | */ |
|
- | 430 | void radeon_doorbell_free(struct radeon_device *rdev, u32 doorbell) |
|
- | 431 | { |
|
- | 432 | if (doorbell < rdev->doorbell.num_doorbells) |
|
- | 433 | __clear_bit(doorbell, rdev->doorbell.used); |
|
- | 434 | } |
|
- | 435 | ||
278 | /* |
436 | /* |
279 | * radeon_wb_*() |
437 | * radeon_wb_*() |
280 | * Writeback is the the method by which the the GPU updates special pages |
438 | * Writeback is the the method by which the the GPU updates special pages |
281 | * in memory with the status of certain GPU events (fences, ring pointers, |
439 | * in memory with the status of certain GPU events (fences, ring pointers, |
282 | * etc.). |
440 | * etc.). |
Line 304... | Line 462... | ||
304 | */ |
462 | */ |
305 | void radeon_wb_fini(struct radeon_device *rdev) |
463 | void radeon_wb_fini(struct radeon_device *rdev) |
306 | { |
464 | { |
307 | radeon_wb_disable(rdev); |
465 | radeon_wb_disable(rdev); |
308 | if (rdev->wb.wb_obj) { |
466 | if (rdev->wb.wb_obj) { |
- | 467 | if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) { |
|
- | 468 | radeon_bo_kunmap(rdev->wb.wb_obj); |
|
- | 469 | radeon_bo_unpin(rdev->wb.wb_obj); |
|
- | 470 | radeon_bo_unreserve(rdev->wb.wb_obj); |
|
- | 471 | } |
|
309 | radeon_bo_unref(&rdev->wb.wb_obj); |
472 | radeon_bo_unref(&rdev->wb.wb_obj); |
310 | rdev->wb.wb = NULL; |
473 | rdev->wb.wb = NULL; |
311 | rdev->wb.wb_obj = NULL; |
474 | rdev->wb.wb_obj = NULL; |
312 | } |
475 | } |
313 | } |
476 | } |
Line 325... | Line 488... | ||
325 | { |
488 | { |
326 | int r; |
489 | int r; |
Line 327... | Line 490... | ||
327 | 490 | ||
328 | if (rdev->wb.wb_obj == NULL) { |
491 | if (rdev->wb.wb_obj == NULL) { |
329 | r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true, |
492 | r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true, |
- | 493 | RADEON_GEM_DOMAIN_GTT, 0, NULL, |
|
330 | RADEON_GEM_DOMAIN_GTT, NULL, &rdev->wb.wb_obj); |
494 | &rdev->wb.wb_obj); |
331 | if (r) { |
495 | if (r) { |
332 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
496 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
333 | return r; |
497 | return r; |
334 | } |
498 | } |
Line 616... | Line 780... | ||
616 | */ |
780 | */ |
617 | int radeon_dummy_page_init(struct radeon_device *rdev) |
781 | int radeon_dummy_page_init(struct radeon_device *rdev) |
618 | { |
782 | { |
619 | if (rdev->dummy_page.page) |
783 | if (rdev->dummy_page.page) |
620 | return 0; |
784 | return 0; |
621 | rdev->dummy_page.page = (void*)AllocPage(); |
785 | rdev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO); |
622 | if (rdev->dummy_page.page == NULL) |
786 | if (rdev->dummy_page.page == NULL) |
623 | return -ENOMEM; |
787 | return -ENOMEM; |
624 | rdev->dummy_page.addr = MapIoMem((addr_t)rdev->dummy_page.page, 4096, 3); |
788 | rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page, |
625 | if (!rdev->dummy_page.addr) { |
- | |
626 | // __free_page(rdev->dummy_page.page); |
789 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
627 | rdev->dummy_page.page = NULL; |
- | |
628 | return -ENOMEM; |
- | |
629 | } |
- | |
630 | return 0; |
790 | return 0; |
631 | } |
791 | } |
Line 632... | Line 792... | ||
632 | 792 | ||
633 | /** |
793 | /** |
Line 639... | Line 799... | ||
639 | */ |
799 | */ |
640 | void radeon_dummy_page_fini(struct radeon_device *rdev) |
800 | void radeon_dummy_page_fini(struct radeon_device *rdev) |
641 | { |
801 | { |
642 | if (rdev->dummy_page.page == NULL) |
802 | if (rdev->dummy_page.page == NULL) |
643 | return; |
803 | return; |
644 | KernelFree((void*)rdev->dummy_page.addr); |
- | |
- | 804 | ||
645 | rdev->dummy_page.page = NULL; |
805 | rdev->dummy_page.page = NULL; |
646 | } |
806 | } |
Line 647... | Line 807... | ||
647 | 807 | ||
Line 942... | Line 1102... | ||
942 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", |
1102 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", |
943 | radeon_vram_limit); |
1103 | radeon_vram_limit); |
944 | radeon_vram_limit = 0; |
1104 | radeon_vram_limit = 0; |
945 | } |
1105 | } |
Line -... | Line 1106... | ||
- | 1106 | ||
- | 1107 | if (radeon_gart_size == -1) { |
|
- | 1108 | /* default to a larger gart size on newer asics */ |
|
- | 1109 | if (rdev->family >= CHIP_RV770) |
|
- | 1110 | radeon_gart_size = 1024; |
|
- | 1111 | else |
|
- | 1112 | radeon_gart_size = 512; |
|
946 | 1113 | } |
|
947 | /* gtt size must be power of two and greater or equal to 32M */ |
1114 | /* gtt size must be power of two and greater or equal to 32M */ |
948 | if (radeon_gart_size < 32) { |
1115 | if (radeon_gart_size < 32) { |
949 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", |
1116 | dev_warn(rdev->dev, "gart size (%d) too small\n", |
- | 1117 | radeon_gart_size); |
|
- | 1118 | if (rdev->family >= CHIP_RV770) |
|
- | 1119 | radeon_gart_size = 1024; |
|
950 | radeon_gart_size); |
1120 | else |
951 | radeon_gart_size = 512; |
- | |
952 | 1121 | radeon_gart_size = 512; |
|
953 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { |
1122 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { |
954 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", |
1123 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", |
- | 1124 | radeon_gart_size); |
|
- | 1125 | if (rdev->family >= CHIP_RV770) |
|
- | 1126 | radeon_gart_size = 1024; |
|
955 | radeon_gart_size); |
1127 | else |
956 | radeon_gart_size = 512; |
1128 | radeon_gart_size = 512; |
957 | } |
1129 | } |
Line 958... | Line 1130... | ||
958 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; |
1130 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; |
Line 970... | Line 1142... | ||
970 | dev_warn(rdev->dev, "invalid AGP mode %d (valid mode: " |
1142 | dev_warn(rdev->dev, "invalid AGP mode %d (valid mode: " |
971 | "-1, 0, 1, 2, 4, 8)\n", radeon_agpmode); |
1143 | "-1, 0, 1, 2, 4, 8)\n", radeon_agpmode); |
972 | radeon_agpmode = 0; |
1144 | radeon_agpmode = 0; |
973 | break; |
1145 | break; |
974 | } |
1146 | } |
- | 1147 | ||
- | 1148 | if (!radeon_check_pot_argument(radeon_vm_size)) { |
|
- | 1149 | dev_warn(rdev->dev, "VM size (%d) must be a power of 2\n", |
|
- | 1150 | radeon_vm_size); |
|
- | 1151 | radeon_vm_size = 4; |
|
- | 1152 | } |
|
- | 1153 | ||
- | 1154 | if (radeon_vm_size < 1) { |
|
- | 1155 | dev_warn(rdev->dev, "VM size (%d) to small, min is 1GB\n", |
|
- | 1156 | radeon_vm_size); |
|
- | 1157 | radeon_vm_size = 4; |
|
- | 1158 | } |
|
- | 1159 | ||
- | 1160 | /* |
|
- | 1161 | * Max GPUVM size for Cayman, SI and CI are 40 bits. |
|
- | 1162 | */ |
|
- | 1163 | if (radeon_vm_size > 1024) { |
|
- | 1164 | dev_warn(rdev->dev, "VM size (%d) too large, max is 1TB\n", |
|
- | 1165 | radeon_vm_size); |
|
- | 1166 | radeon_vm_size = 4; |
|
- | 1167 | } |
|
- | 1168 | ||
- | 1169 | /* defines number of bits in page table versus page directory, |
|
- | 1170 | * a page is 4KB so we have 12 bits offset, minimum 9 bits in the |
|
- | 1171 | * page table and the remaining bits are in the page directory */ |
|
- | 1172 | if (radeon_vm_block_size == -1) { |
|
- | 1173 | ||
- | 1174 | /* Total bits covered by PD + PTs */ |
|
- | 1175 | unsigned bits = ilog2(radeon_vm_size) + 17; |
|
- | 1176 | ||
- | 1177 | /* Make sure the PD is 4K in size up to 8GB address space. |
|
- | 1178 | Above that split equal between PD and PTs */ |
|
- | 1179 | if (radeon_vm_size <= 8) |
|
- | 1180 | radeon_vm_block_size = bits - 9; |
|
- | 1181 | else |
|
- | 1182 | radeon_vm_block_size = (bits + 3) / 2; |
|
- | 1183 | ||
- | 1184 | } else if (radeon_vm_block_size < 9) { |
|
- | 1185 | dev_warn(rdev->dev, "VM page table size (%d) too small\n", |
|
- | 1186 | radeon_vm_block_size); |
|
- | 1187 | radeon_vm_block_size = 9; |
|
- | 1188 | } |
|
- | 1189 | ||
- | 1190 | if (radeon_vm_block_size > 24 || |
|
- | 1191 | (radeon_vm_size * 1024) < (1ull << radeon_vm_block_size)) { |
|
- | 1192 | dev_warn(rdev->dev, "VM page table size (%d) too large\n", |
|
- | 1193 | radeon_vm_block_size); |
|
- | 1194 | radeon_vm_block_size = 9; |
|
- | 1195 | } |
|
975 | } |
1196 | } |
Line -... | Line 1197... | ||
- | 1197 | ||
- | 1198 | /** |
|
- | 1199 | * radeon_device_init - initialize the driver |
|
- | 1200 | * |
|
- | 1201 | * @rdev: radeon_device pointer |
|
- | 1202 | * @pdev: drm dev pointer |
|
- | 1203 | * @pdev: pci dev pointer |
|
- | 1204 | * @flags: driver flags |
|
- | 1205 | * |
|
- | 1206 | * Initializes the driver info and hw (all asics). |
|
- | 1207 | * Returns 0 for success or an error on failure. |
|
- | 1208 | * Called at driver startup. |
|
976 | 1209 | */ |
|
977 | int radeon_device_init(struct radeon_device *rdev, |
1210 | int radeon_device_init(struct radeon_device *rdev, |
978 | struct drm_device *ddev, |
1211 | struct drm_device *ddev, |
979 | struct pci_dev *pdev, |
1212 | struct pci_dev *pdev, |
980 | uint32_t flags) |
1213 | uint32_t flags) |
981 | { |
1214 | { |
982 | int r, i; |
1215 | int r, i; |
- | 1216 | int dma_bits; |
|
Line 983... | Line 1217... | ||
983 | int dma_bits; |
1217 | bool runtime = false; |
- | 1218 | ||
984 | 1219 | rdev->shutdown = false; |
|
985 | rdev->shutdown = false; |
1220 | rdev->dev = &pdev->dev; |
986 | rdev->ddev = ddev; |
1221 | rdev->ddev = ddev; |
987 | rdev->pdev = pdev; |
1222 | rdev->pdev = pdev; |
988 | rdev->flags = flags; |
1223 | rdev->flags = flags; |
989 | rdev->family = flags & RADEON_FAMILY_MASK; |
1224 | rdev->family = flags & RADEON_FAMILY_MASK; |
990 | rdev->is_atom_bios = false; |
1225 | rdev->is_atom_bios = false; |
991 | rdev->usec_timeout = RADEON_MAX_USEC_TIMEOUT; |
1226 | rdev->usec_timeout = RADEON_MAX_USEC_TIMEOUT; |
992 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; |
1227 | rdev->mc.gtt_size = 512 * 1024 * 1024; |
993 | rdev->accel_working = false; |
1228 | rdev->accel_working = false; |
994 | /* set up ring ids */ |
1229 | /* set up ring ids */ |
995 | for (i = 0; i < RADEON_NUM_RINGS; i++) { |
1230 | for (i = 0; i < RADEON_NUM_RINGS; i++) { |
Line 1006... | Line 1241... | ||
1006 | mutex_init(&rdev->dc_hw_i2c_mutex); |
1241 | mutex_init(&rdev->dc_hw_i2c_mutex); |
1007 | atomic_set(&rdev->ih.lock, 0); |
1242 | atomic_set(&rdev->ih.lock, 0); |
1008 | mutex_init(&rdev->gem.mutex); |
1243 | mutex_init(&rdev->gem.mutex); |
1009 | mutex_init(&rdev->pm.mutex); |
1244 | mutex_init(&rdev->pm.mutex); |
1010 | mutex_init(&rdev->gpu_clock_mutex); |
1245 | mutex_init(&rdev->gpu_clock_mutex); |
- | 1246 | mutex_init(&rdev->srbm_mutex); |
|
1011 | // init_rwsem(&rdev->pm.mclk_lock); |
1247 | // init_rwsem(&rdev->pm.mclk_lock); |
1012 | // init_rwsem(&rdev->exclusive_lock); |
1248 | // init_rwsem(&rdev->exclusive_lock); |
1013 | init_waitqueue_head(&rdev->irq.vblank_queue); |
1249 | init_waitqueue_head(&rdev->irq.vblank_queue); |
1014 | r = radeon_gem_init(rdev); |
1250 | r = radeon_gem_init(rdev); |
1015 | if (r) |
1251 | if (r) |
1016 | return r; |
1252 | return r; |
1017 | /* initialize vm here */ |
- | |
- | 1253 | ||
1018 | mutex_init(&rdev->vm_manager.lock); |
1254 | radeon_check_arguments(rdev); |
1019 | /* Adjust VM size here. |
1255 | /* Adjust VM size here. |
1020 | * Currently set to 4GB ((1 << 20) 4k pages). |
- | |
1021 | * Max GPUVM size for cayman and SI is 40 bits. |
1256 | * Max GPUVM size for cayman+ is 40 bits. |
1022 | */ |
1257 | */ |
1023 | rdev->vm_manager.max_pfn = 1 << 20; |
1258 | rdev->vm_manager.max_pfn = radeon_vm_size << 18; |
1024 | INIT_LIST_HEAD(&rdev->vm_manager.lru_vm); |
- | |
Line 1025... | Line 1259... | ||
1025 | 1259 | ||
1026 | /* Set asic functions */ |
1260 | /* Set asic functions */ |
1027 | r = radeon_asic_init(rdev); |
1261 | r = radeon_asic_init(rdev); |
1028 | if (r) |
1262 | if (r) |
1029 | return r; |
- | |
Line 1030... | Line 1263... | ||
1030 | radeon_check_arguments(rdev); |
1263 | return r; |
1031 | 1264 | ||
1032 | /* all of the newer IGP chips have an internal gart |
1265 | /* all of the newer IGP chips have an internal gart |
1033 | * However some rs4xx report as AGP, so remove that here. |
1266 | * However some rs4xx report as AGP, so remove that here. |
Line 1074... | Line 1307... | ||
1074 | } |
1307 | } |
Line 1075... | Line 1308... | ||
1075 | 1308 | ||
1076 | /* Registers mapping */ |
1309 | /* Registers mapping */ |
1077 | /* TODO: block userspace mapping of io register */ |
1310 | /* TODO: block userspace mapping of io register */ |
- | 1311 | spin_lock_init(&rdev->mmio_idx_lock); |
|
- | 1312 | spin_lock_init(&rdev->smc_idx_lock); |
|
- | 1313 | spin_lock_init(&rdev->pll_idx_lock); |
|
- | 1314 | spin_lock_init(&rdev->mc_idx_lock); |
|
- | 1315 | spin_lock_init(&rdev->pcie_idx_lock); |
|
- | 1316 | spin_lock_init(&rdev->pciep_idx_lock); |
|
- | 1317 | spin_lock_init(&rdev->pif_idx_lock); |
|
- | 1318 | spin_lock_init(&rdev->cg_idx_lock); |
|
- | 1319 | spin_lock_init(&rdev->uvd_idx_lock); |
|
- | 1320 | spin_lock_init(&rdev->rcu_idx_lock); |
|
- | 1321 | spin_lock_init(&rdev->didt_idx_lock); |
|
- | 1322 | spin_lock_init(&rdev->end_idx_lock); |
|
- | 1323 | if (rdev->family >= CHIP_BONAIRE) { |
|
- | 1324 | rdev->rmmio_base = pci_resource_start(rdev->pdev, 5); |
|
- | 1325 | rdev->rmmio_size = pci_resource_len(rdev->pdev, 5); |
|
1078 | spin_lock_init(&rdev->mmio_idx_lock); |
1326 | } else { |
1079 | rdev->rmmio_base = pci_resource_start(rdev->pdev, 2); |
1327 | rdev->rmmio_base = pci_resource_start(rdev->pdev, 2); |
- | 1328 | rdev->rmmio_size = pci_resource_len(rdev->pdev, 2); |
|
1080 | rdev->rmmio_size = pci_resource_len(rdev->pdev, 2); |
1329 | } |
1081 | rdev->rmmio = ioremap(rdev->rmmio_base, rdev->rmmio_size); |
1330 | rdev->rmmio = ioremap(rdev->rmmio_base, rdev->rmmio_size); |
1082 | if (rdev->rmmio == NULL) { |
1331 | if (rdev->rmmio == NULL) { |
1083 | return -ENOMEM; |
1332 | return -ENOMEM; |
1084 | } |
1333 | } |
1085 | DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)rdev->rmmio_base); |
1334 | DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)rdev->rmmio_base); |
Line -... | Line 1335... | ||
- | 1335 | DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); |
|
- | 1336 | ||
- | 1337 | /* doorbell bar mapping */ |
|
- | 1338 | if (rdev->family >= CHIP_BONAIRE) |
|
1086 | DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); |
1339 | radeon_doorbell_init(rdev); |
1087 | 1340 | ||
1088 | /* io port mapping */ |
1341 | /* io port mapping */ |
1089 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
1342 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
1090 | if (pci_resource_flags(rdev->pdev, i) & IORESOURCE_IO) { |
1343 | if (pci_resource_flags(rdev->pdev, i) & IORESOURCE_IO) { |
Line 1094... | Line 1347... | ||
1094 | } |
1347 | } |
1095 | } |
1348 | } |
1096 | if (rdev->rio_mem == NULL) |
1349 | if (rdev->rio_mem == NULL) |
1097 | DRM_ERROR("Unable to find PCI I/O BAR\n"); |
1350 | DRM_ERROR("Unable to find PCI I/O BAR\n"); |
Line -... | Line 1351... | ||
- | 1351 | ||
- | 1352 | if (rdev->flags & RADEON_IS_PX) |
|
- | 1353 | radeon_device_handle_px_quirks(rdev); |
|
- | 1354 | if (rdev->flags & RADEON_IS_PX) |
|
Line 1098... | Line 1355... | ||
1098 | 1355 | runtime = true; |
|
1099 | 1356 | ||
1100 | r = radeon_init(rdev); |
1357 | r = radeon_init(rdev); |
Line 1101... | Line 1358... | ||
1101 | if (r) |
1358 | if (r) |
1102 | return r; |
1359 | return r; |
1103 | 1360 | ||
- | 1361 | r = radeon_ib_ring_tests(rdev); |
|
Line 1104... | Line 1362... | ||
1104 | // r = radeon_ib_ring_tests(rdev); |
1362 | if (r) |
1105 | // if (r) |
1363 | DRM_ERROR("ib ring test failed (%d).\n", r); |
1106 | // DRM_ERROR("ib ring test failed (%d).\n", r); |
1364 | |
1107 | 1365 | ||
Line 1114... | Line 1372... | ||
1114 | radeon_agp_disable(rdev); |
1372 | radeon_agp_disable(rdev); |
1115 | r = radeon_init(rdev); |
1373 | r = radeon_init(rdev); |
1116 | if (r) |
1374 | if (r) |
1117 | return r; |
1375 | return r; |
1118 | } |
1376 | } |
- | 1377 | ||
1119 | // if (radeon_testing) { |
1378 | if ((radeon_testing & 1)) { |
- | 1379 | if (rdev->accel_working) |
|
1120 | // radeon_test_moves(rdev); |
1380 | radeon_test_moves(rdev); |
1121 | // } |
1381 | else |
- | 1382 | DRM_INFO("radeon: acceleration disabled, skipping move tests\n"); |
|
- | 1383 | } |
|
1122 | // if ((radeon_testing & 2)) { |
1384 | if ((radeon_testing & 2)) { |
- | 1385 | if (rdev->accel_working) |
|
1123 | // radeon_test_syncing(rdev); |
1386 | radeon_test_syncing(rdev); |
- | 1387 | else |
|
- | 1388 | DRM_INFO("radeon: acceleration disabled, skipping sync tests\n"); |
|
1124 | // } |
1389 | } |
1125 | if (radeon_benchmarking) { |
1390 | if (radeon_benchmarking) { |
- | 1391 | if (rdev->accel_working) |
|
1126 | radeon_benchmark(rdev, radeon_benchmarking); |
1392 | radeon_benchmark(rdev, radeon_benchmarking); |
- | 1393 | else |
|
- | 1394 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); |
|
1127 | } |
1395 | } |
1128 | return 0; |
1396 | return 0; |
1129 | } |
1397 | } |
Line 1130... | Line 1398... | ||
1130 | 1398 | ||
Line 1145... | Line 1413... | ||
1145 | 1413 | ||
1146 | int i, r; |
1414 | int i, r; |
Line 1147... | Line 1415... | ||
1147 | int resched; |
1415 | int resched; |
- | 1416 | ||
- | 1417 | // down_write(&rdev->exclusive_lock); |
|
1148 | 1418 | rdev->needs_reset = false; |
|
1149 | // down_write(&rdev->exclusive_lock); |
1419 | |
1150 | radeon_save_bios_scratch_regs(rdev); |
1420 | radeon_save_bios_scratch_regs(rdev); |
1151 | /* block TTM */ |
1421 | /* block TTM */ |
Line 1243... | Line 1513... | ||
1243 | } |
1513 | } |
1244 | /* Again modeset_init should fail only on fatal error |
1514 | /* Again modeset_init should fail only on fatal error |
1245 | * otherwise it should provide enough functionalities |
1515 | * otherwise it should provide enough functionalities |
1246 | * for shadowfb to run |
1516 | * for shadowfb to run |
1247 | */ |
1517 | */ |
- | 1518 | main_device = dev; |
|
- | 1519 | ||
1248 | if( radeon_modeset ) |
1520 | if( radeon_modeset ) |
1249 | { |
1521 | { |
1250 | r = radeon_modeset_init(rdev); |
1522 | r = radeon_modeset_init(rdev); |
1251 | if (r) { |
1523 | if (r) { |
1252 | return r; |
1524 | return r; |
1253 | } |
1525 | } |
1254 | }; |
- | |
1255 | return 0; |
1526 | init_display_kms(dev, &usermode); |
1256 | } |
1527 | } |
1257 | - | ||
1258 | videomode_t usermode; |
- | |
1259 | - | ||
1260 | - | ||
1261 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
- | |
1262 | { |
- | |
1263 | static struct drm_device *dev; |
- | |
1264 | int ret; |
- | |
1265 | - | ||
1266 | dev = kzalloc(sizeof(*dev), 0); |
- | |
1267 | if (!dev) |
- | |
1268 | return -ENOMEM; |
- | |
1269 | - | ||
1270 | // ret = pci_enable_device(pdev); |
- | |
1271 | // if (ret) |
- | |
1272 | // goto err_g1; |
- | |
1273 | - | ||
1274 | // pci_set_master(pdev); |
- | |
1275 | - | ||
1276 | // if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) { |
- | |
1277 | // printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); |
- | |
1278 | // goto err_g2; |
- | |
1279 | // } |
- | |
1280 | - | ||
1281 | dev->pdev = pdev; |
- | |
1282 | dev->pci_device = pdev->device; |
- | |
1283 | dev->pci_vendor = pdev->vendor; |
- | |
1284 | - | ||
1285 | INIT_LIST_HEAD(&dev->filelist); |
- | |
1286 | INIT_LIST_HEAD(&dev->ctxlist); |
- | |
1287 | INIT_LIST_HEAD(&dev->vmalist); |
- | |
1288 | INIT_LIST_HEAD(&dev->maplist); |
- | |
1289 | - | ||
1290 | spin_lock_init(&dev->count_lock); |
- | |
1291 | mutex_init(&dev->struct_mutex); |
- | |
1292 | mutex_init(&dev->ctxlist_mutex); |
- | |
1293 | - | ||
1294 | - | ||
1295 | ret = radeon_driver_load_kms(dev, ent->driver_data ); |
- | |
1296 | if (ret) |
- | |
1297 | goto err_g4; |
- | |
1298 | - | ||
1299 | main_drm_device = dev; |
- | |
1300 | - | ||
1301 | if( radeon_modeset ) |
- | |
1302 | init_display_kms(dev->dev_private, &usermode); |
- | |
1303 | else |
1528 | else |
1304 | init_display(dev->dev_private, &usermode); |
1529 | init_display(rdev, &usermode); |
1305 | - | ||
Line 1306... | Line 1530... | ||
1306 | 1530 | ||
- | 1531 | return 0; |
|
Line 1307... | Line -... | ||
1307 | return 0; |
- | |
1308 | - | ||
1309 | err_g4: |
- | |
1310 | // drm_put_minor(&dev->primary); |
- | |
1311 | //err_g3: |
- | |
1312 | // if (drm_core_check_feature(dev, DRIVER_MODESET)) |
- | |
1313 | // drm_put_minor(&dev->control); |
- | |
1314 | //err_g2: |
- | |
1315 | // pci_disable_device(pdev); |
- | |
1316 | //err_g1: |
- | |
1317 | free(dev); |
- | |
Line 1318... | Line -... | ||
1318 | - | ||
1319 | LEAVE(); |
- | |
Line 1320... | Line 1532... | ||
1320 | 1532 | } |
|
1321 | return ret; |
1533 | |
1322 | } |
1534 | |
1323 | 1535 | ||
Line 1363... | Line 1575... | ||
1363 | 1575 | ||
1364 | *n = res; |
1576 | *n = res; |
1365 | return rem; |
1577 | return rem; |
Line 1366... | Line -... | ||
1366 | } |
- | |
1367 | 1578 | } |
|
1368 | 1579 | ||
1369 | static struct pci_device_id pciidlist[] = { |
1580 | static struct pci_device_id pciidlist[] = { |
Line -... | Line 1581... | ||
- | 1581 | radeon_PCI_IDS |
|
- | 1582 | }; |
|
- | 1583 | ||
- | 1584 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev); |
|
- | 1585 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev); |
|
- | 1586 | void radeon_driver_irq_uninstall_kms(struct drm_device *dev); |
|
- | 1587 | irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg); |
|
- | 1588 | ||
- | 1589 | ||
- | 1590 | static struct drm_driver kms_driver = { |
|
- | 1591 | .driver_features = |
|
- | 1592 | DRIVER_USE_AGP | |
|
- | 1593 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | |
|
- | 1594 | DRIVER_PRIME | DRIVER_RENDER, |
|
- | 1595 | .load = radeon_driver_load_kms, |
|
- | 1596 | // .open = radeon_driver_open_kms, |
|
- | 1597 | // .preclose = radeon_driver_preclose_kms, |
|
- | 1598 | // .postclose = radeon_driver_postclose_kms, |
|
- | 1599 | // .lastclose = radeon_driver_lastclose_kms, |
|
- | 1600 | // .unload = radeon_driver_unload_kms, |
|
- | 1601 | // .get_vblank_counter = radeon_get_vblank_counter_kms, |
|
- | 1602 | // .enable_vblank = radeon_enable_vblank_kms, |
|
- | 1603 | // .disable_vblank = radeon_disable_vblank_kms, |
|
- | 1604 | // .get_vblank_timestamp = radeon_get_vblank_timestamp_kms, |
|
- | 1605 | // .get_scanout_position = radeon_get_crtc_scanoutpos, |
|
- | 1606 | #if defined(CONFIG_DEBUG_FS) |
|
- | 1607 | .debugfs_init = radeon_debugfs_init, |
|
- | 1608 | .debugfs_cleanup = radeon_debugfs_cleanup, |
|
- | 1609 | #endif |
|
- | 1610 | .irq_preinstall = radeon_driver_irq_preinstall_kms, |
|
- | 1611 | .irq_postinstall = radeon_driver_irq_postinstall_kms, |
|
- | 1612 | .irq_uninstall = radeon_driver_irq_uninstall_kms, |
|
- | 1613 | .irq_handler = radeon_driver_irq_handler_kms, |
|
- | 1614 | // .ioctls = radeon_ioctls_kms, |
|
- | 1615 | // .gem_free_object = radeon_gem_object_free, |
|
- | 1616 | // .gem_open_object = radeon_gem_object_open, |
|
- | 1617 | // .gem_close_object = radeon_gem_object_close, |
|
- | 1618 | // .dumb_create = radeon_mode_dumb_create, |
|
- | 1619 | // .dumb_map_offset = radeon_mode_dumb_mmap, |
|
- | 1620 | // .dumb_destroy = drm_gem_dumb_destroy, |
|
- | 1621 | // .fops = &radeon_driver_kms_fops, |
|
- | 1622 | ||
- | 1623 | // .prime_handle_to_fd = drm_gem_prime_handle_to_fd, |
|
- | 1624 | // .prime_fd_to_handle = drm_gem_prime_fd_to_handle, |
|
- | 1625 | // .gem_prime_export = drm_gem_prime_export, |
|
- | 1626 | // .gem_prime_import = drm_gem_prime_import, |
|
- | 1627 | // .gem_prime_pin = radeon_gem_prime_pin, |
|
- | 1628 | // .gem_prime_unpin = radeon_gem_prime_unpin, |
|
- | 1629 | // .gem_prime_get_sg_table = radeon_gem_prime_get_sg_table, |
|
Line 1370... | Line -... | ||
1370 | radeon_PCI_IDS |
- | |
1371 | }; |
- | |
1372 | - | ||
1373 | - | ||
1374 | #define CURRENT_API 0x0200 /* 2.00 */ |
- | |
1375 | #define COMPATIBLE_API 0x0100 /* 1.00 */ |
- | |
1376 | - | ||
1377 | #define API_VERSION (COMPATIBLE_API << 16) | CURRENT_API |
- | |
1378 | - | ||
1379 | #define SRV_GETVERSION 0 |
- | |
1380 | #define SRV_ENUM_MODES 1 |
- | |
1381 | #define SRV_SET_MODE 2 |
- | |
1382 | #define SRV_GET_CAPS 3 |
- | |
1383 | - | ||
1384 | #define SRV_CREATE_SURFACE 10 |
- | |
1385 | #define SRV_DESTROY_SURFACE 11 |
- | |
1386 | #define SRV_LOCK_SURFACE 12 |
- | |
1387 | #define SRV_UNLOCK_SURFACE 13 |
- | |
1388 | #define SRV_RESIZE_SURFACE 14 |
- | |
1389 | #define SRV_BLIT_BITMAP 15 |
- | |
1390 | #define SRV_BLIT_TEXTURE 16 |
- | |
1391 | #define SRV_BLIT_VIDEO 17 |
- | |
1392 | - | ||
1393 | - | ||
1394 | - | ||
1395 | int r600_video_blit(uint64_t src_offset, int x, int y, |
- | |
1396 | int w, int h, int pitch); |
- | |
1397 | - | ||
1398 | #define check_input(size) \ |
- | |
1399 | if( unlikely((inp==NULL)||(io->inp_size != (size))) ) \ |
- | |
1400 | break; |
- | |
1401 | - | ||
1402 | #define check_output(size) \ |
- | |
1403 | if( unlikely((outp==NULL)||(io->out_size != (size))) ) \ |
- | |
1404 | break; |
- | |
1405 | - | ||
1406 | int _stdcall display_handler(ioctl_t *io) |
- | |
1407 | { |
- | |
1408 | int retval = -1; |
- | |
1409 | u32_t *inp; |
- | |
1410 | u32_t *outp; |
- | |
1411 | - | ||
1412 | inp = io->input; |
- | |
1413 | outp = io->output; |
- | |
1414 | - | ||
1415 | switch(io->io_code) |
- | |
1416 | { |
- | |
1417 | case SRV_GETVERSION: |
- | |
1418 | check_output(4); |
- | |
1419 | *outp = API_VERSION; |
- | |
1420 | retval = 0; |
- | |
1421 | break; |
- | |
1422 | - | ||
1423 | case SRV_ENUM_MODES: |
- | |
1424 | dbgprintf("SRV_ENUM_MODES inp %x inp_size %x out_size %x\n", |
- | |
1425 | inp, io->inp_size, io->out_size ); |
- | |
1426 | check_output(4); |
- | |
1427 | if( radeon_modeset) |
- | |
1428 | retval = get_modes((videomode_t*)inp, outp); |
- | |
1429 | break; |
- | |
1430 | - | ||
1431 | case SRV_SET_MODE: |
- | |
1432 | dbgprintf("SRV_SET_MODE inp %x inp_size %x\n", |
- | |
1433 | inp, io->inp_size); |
- | |
1434 | check_input(sizeof(videomode_t)); |
- | |
1435 | if( radeon_modeset ) |
- | |
1436 | retval = set_user_mode((videomode_t*)inp); |
- | |
1437 | break; |
- | |
1438 | /* |
- | |
1439 | case SRV_GET_CAPS: |
- | |
1440 | retval = get_driver_caps((hwcaps_t*)inp); |
- | |
1441 | break; |
- | |
1442 | - | ||
1443 | case SRV_CREATE_SURFACE: |
- | |
1444 | // check_input(8); |
- | |
1445 | retval = create_surface(main_drm_device, (struct io_call_10*)inp); |
- | |
1446 | break; |
- | |
1447 | - | ||
1448 | case SRV_LOCK_SURFACE: |
- | |
1449 | retval = lock_surface((struct io_call_12*)inp); |
- | |
1450 | break; |
- | |
1451 | - | ||
1452 | case SRV_BLIT_BITMAP: |
1630 | // .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table, |
Line 1453... | Line -... | ||
1453 | srv_blit_bitmap( inp[0], inp[1], inp[2], |
- | |
1454 | inp[3], inp[4], inp[5], inp[6]); |
- | |
1455 | */ |
- | |
1456 | }; |
- | |
1457 | 1631 | // .gem_prime_vmap = radeon_gem_prime_vmap, |
|
1458 | return retval; |
- | |
1459 | } |
- | |
1460 | 1632 | // .gem_prime_vunmap = radeon_gem_prime_vunmap, |
|
1461 | static char log[256]; |
1633 | |
1462 | static pci_dev_t device; |
- | |
1463 | 1634 | }; |
|
1464 | u32_t drvEntry(int action, char *cmdline) |
- | |
1465 | { |
1635 | |
1466 | struct radeon_device *rdev = NULL; |
- | |
1467 | - | ||
1468 | const struct pci_device_id *ent; |
- | |
1469 | - | ||
1470 | int err; |
- | |
1471 | u32_t retval = 0; |
- | |
1472 | - | ||
1473 | if(action != 1) |
- | |
1474 | return 0; |
- | |
1475 | - | ||
1476 | if( GetService("DISPLAY") != 0 ) |
- | |
1477 | return 0; |
- | |
1478 | - | ||
1479 | if( cmdline && *cmdline ) |
- | |
1480 | parse_cmdline(cmdline, &usermode, log, &radeon_modeset); |
- | |
1481 | - | ||
1482 | if(!dbg_open(log)) |
- | |
1483 | { |
- | |
1484 | strcpy(log, "/TMP1/1/ati.log"); |
- | |
1485 | - | ||
1486 | if(!dbg_open(log)) |
- | |
1487 | { |
- | |
1488 | printf("Can't open %s\nExit\n", log); |
- | |
1489 | return 0; |
- | |
1490 | }; |
- | |
1491 | } |
- | |
Line 1492... | Line 1636... | ||
1492 | dbgprintf("Radeon v3.10 preview-1 cmdline %s\n", cmdline); |
1636 | int ati_init(void) |
1493 | - | ||
1494 | cpu_detect(); |
1637 | { |
1495 | 1638 | static pci_dev_t device; |
|
1496 | enum_pci_devices(); |
1639 | const struct pci_device_id *ent; |
1497 | 1640 | int err; |
|
1498 | ent = find_pci_device(&device, pciidlist); |
1641 | |
Line 1499... | Line -... | ||
1499 | - | ||
1500 | if( unlikely(ent == NULL) ) |
- | |
1501 | { |
- | |
1502 | dbgprintf("device not found\n"); |
1642 | ent = find_pci_device(&device, pciidlist); |
1503 | return 0; |
- | |
1504 | }; |
- | |
Line 1505... | Line 1643... | ||
1505 | 1643 | if( unlikely(ent == NULL) ) |
|
- | 1644 | { |
|
Line 1506... | Line 1645... | ||
1506 | dbgprintf("device %x:%x\n", device.pci_dev.vendor, |
1645 | dbgprintf("device not found\n"); |
Line 1507... | Line -... | ||
1507 | device.pci_dev.device); |
- | |
1508 | 1646 | return -ENODEV; |
|
Line 1509... | Line 1647... | ||
1509 | drm_global_init(); |
1647 | }; |
1510 | - | ||
1511 | err = drm_get_dev(&device.pci_dev, ent); |
- | |
1512 | - | ||
1513 | rdev = rdisplay->ddev->dev_private; |
- | |
1514 | - | ||
1515 | err = RegService("DISPLAY", display_handler); |
- | |
1516 | - | ||
1517 | if( err != 0) |
- | |
1518 | dbgprintf("Set DISPLAY handler\n"); |
- | |
1519 | - | ||
1520 | return err; |
- | |
1521 | }; |
- | |
1522 | - | ||
1523 | #define PCI_CLASS_REVISION 0x08 |
- | |
1524 | #define PCI_CLASS_DISPLAY_VGA 0x0300 |
- | |
1525 | - | ||
1526 | int pci_scan_filter(u32_t id, u32_t busnr, u32_t devfn) |
- | |
1527 | { |
- | |
1528 | u16_t vendor, device; |
- | |
1529 | u32_t class; |
- | |
1530 | int ret = 0; |
- | |
1531 | - | ||
1532 | vendor = id & 0xffff; |
- | |
1533 | device = (id >> 16) & 0xffff; |
1648 | |
Line -... | Line 1649... | ||
- | 1649 | drm_core_init(); |