Merge branch 'drm-fixes-3.6' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

Alex writes:

"This is the current set of radeon fixes for 3.6. Nothing too major.

Highlights:
- fix vbios fetch on pure uefi systems
- fix vbios fetch on thunderbolt systems
- MSAA fixes
- lockup timeout fix
- modesetting fix"

* 'drm-fixes-3.6' of git://people.freedesktop.org/~agd5f/linux:
drm/radeon/ss: use num_crtc rather than hardcoded 6
Revert "drm/radeon: fix bo creation retry path"
drm/radeon: split ATRM support out from the ATPX handler (v3)
drm/radeon: convert radeon vfct code to use acpi_get_table_with_size
ACPI: export symbol acpi_get_table_with_size
drm/radeon: implement ACPI VFCT vbios fetch (v3)
drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping
drm/radeon: fix checking of MSAA renderbuffers on r600-r700
drm/radeon: allow CMASK and FMASK in the CS checker on r600-r700
drm/radeon: init lockup timeout on ring init
drm/radeon: avoid turning off spread spectrum for used pll

+267 -107
+1
drivers/acpi/acpica/tbxface.c
··· 387 387 388 388 return (AE_NOT_FOUND); 389 389 } 390 + ACPI_EXPORT_SYMBOL(acpi_get_table_with_size) 390 391 391 392 acpi_status 392 393 acpi_get_table(char *signature,
+21 -4
drivers/gpu/drm/radeon/atombios_crtc.c
··· 444 444 static void atombios_crtc_program_ss(struct radeon_device *rdev, 445 445 int enable, 446 446 int pll_id, 447 + int crtc_id, 447 448 struct radeon_atom_ss *ss) 448 449 { 450 + unsigned i; 449 451 int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); 450 452 union atom_enable_ss args; 453 + 454 + if (!enable) { 455 + for (i = 0; i < rdev->num_crtc; i++) { 456 + if (rdev->mode_info.crtcs[i] && 457 + rdev->mode_info.crtcs[i]->enabled && 458 + i != crtc_id && 459 + pll_id == rdev->mode_info.crtcs[i]->pll_id) { 460 + /* one other crtc is using this pll don't turn 461 + * off spread spectrum as it might turn off 462 + * display on active crtc 463 + */ 464 + return; 465 + } 466 + } 467 + } 451 468 452 469 memset(&args, 0, sizeof(args)); 453 470 ··· 1045 1028 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, 1046 1029 &ref_div, &post_div); 1047 1030 1048 - atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, &ss); 1031 + atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); 1049 1032 1050 1033 atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, 1051 1034 encoder_mode, radeon_encoder->encoder_id, mode->clock, ··· 1068 1051 ss.step = step_size; 1069 1052 } 1070 1053 1071 - atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, &ss); 1054 + atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); 1072 1055 } 1073 1056 } 1074 1057 ··· 1589 1572 ASIC_INTERNAL_SS_ON_DCPLL, 1590 1573 rdev->clock.default_dispclk); 1591 1574 if (ss_enabled) 1592 - atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, &ss); 1575 + atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, -1, &ss); 1593 1576 /* XXX: DCE5, make sure voltage, dispclk is high enough */ 1594 1577 atombios_crtc_set_disp_eng_pll(rdev, rdev->clock.default_dispclk); 1595 1578 if (ss_enabled) 1596 - atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, &ss); 1579 + atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, -1, &ss); 1597 1580 } 1598 1581 1599 1582 }
+88 -17
drivers/gpu/drm/radeon/r600_cs.c
··· 47 47 u32 npipes; 48 48 /* value we track */ 49 49 u32 sq_config; 50 + u32 log_nsamples; 50 51 u32 nsamples; 51 52 u32 cb_color_base_last[8]; 52 53 struct radeon_bo *cb_color_bo[8]; 53 54 u64 cb_color_bo_mc[8]; 54 - u32 cb_color_bo_offset[8]; 55 - struct radeon_bo *cb_color_frag_bo[8]; /* unused */ 56 - struct radeon_bo *cb_color_tile_bo[8]; /* unused */ 55 + u64 cb_color_bo_offset[8]; 56 + struct radeon_bo *cb_color_frag_bo[8]; 57 + u64 cb_color_frag_offset[8]; 58 + struct radeon_bo *cb_color_tile_bo[8]; 59 + u64 cb_color_tile_offset[8]; 60 + u32 cb_color_mask[8]; 57 61 u32 cb_color_info[8]; 58 62 u32 cb_color_view[8]; 59 63 u32 cb_color_size_idx[8]; /* unused */ ··· 353 349 unsigned array_mode; 354 350 u32 format; 355 351 356 - if (G_0280A0_TILE_MODE(track->cb_color_info[i])) { 357 - dev_warn(p->dev, "FMASK or CMASK buffer are not supported by this kernel\n"); 358 - return -EINVAL; 359 - } 360 352 size = radeon_bo_size(track->cb_color_bo[i]) - track->cb_color_bo_offset[i]; 361 353 format = G_0280A0_FORMAT(track->cb_color_info[i]); 362 354 if (!r600_fmt_is_valid_color(format)) { ··· 420 420 } 421 421 422 422 /* check offset */ 423 - tmp = r600_fmt_get_nblocksy(format, height) * r600_fmt_get_nblocksx(format, pitch) * r600_fmt_get_blocksize(format); 423 + tmp = r600_fmt_get_nblocksy(format, height) * r600_fmt_get_nblocksx(format, pitch) * 424 + r600_fmt_get_blocksize(format) * track->nsamples; 424 425 switch (array_mode) { 425 426 default: 426 427 case V_0280A0_ARRAY_LINEAR_GENERAL: ··· 442 441 * broken userspace. 443 442 */ 444 443 } else { 445 - dev_warn(p->dev, "%s offset[%d] %d %d %d %lu too big (%d %d) (%d %d %d)\n", 444 + dev_warn(p->dev, "%s offset[%d] %d %llu %d %lu too big (%d %d) (%d %d %d)\n", 446 445 __func__, i, array_mode, 447 446 track->cb_color_bo_offset[i], tmp, 448 447 radeon_bo_size(track->cb_color_bo[i]), ··· 459 458 tmp = S_028060_PITCH_TILE_MAX((pitch / 8) - 1) | 460 459 S_028060_SLICE_TILE_MAX(slice_tile_max - 1); 461 460 ib[track->cb_color_size_idx[i]] = tmp; 461 + 462 + /* FMASK/CMASK */ 463 + switch (G_0280A0_TILE_MODE(track->cb_color_info[i])) { 464 + case V_0280A0_TILE_DISABLE: 465 + break; 466 + case V_0280A0_FRAG_ENABLE: 467 + if (track->nsamples > 1) { 468 + uint32_t tile_max = G_028100_FMASK_TILE_MAX(track->cb_color_mask[i]); 469 + /* the tile size is 8x8, but the size is in units of bits. 470 + * for bytes, do just * 8. */ 471 + uint32_t bytes = track->nsamples * track->log_nsamples * 8 * (tile_max + 1); 472 + 473 + if (bytes + track->cb_color_frag_offset[i] > 474 + radeon_bo_size(track->cb_color_frag_bo[i])) { 475 + dev_warn(p->dev, "%s FMASK_TILE_MAX too large " 476 + "(tile_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n", 477 + __func__, tile_max, bytes, 478 + track->cb_color_frag_offset[i], 479 + radeon_bo_size(track->cb_color_frag_bo[i])); 480 + return -EINVAL; 481 + } 482 + } 483 + /* fall through */ 484 + case V_0280A0_CLEAR_ENABLE: 485 + { 486 + uint32_t block_max = G_028100_CMASK_BLOCK_MAX(track->cb_color_mask[i]); 487 + /* One block = 128x128 pixels, one 8x8 tile has 4 bits.. 488 + * (128*128) / (8*8) / 2 = 128 bytes per block. */ 489 + uint32_t bytes = (block_max + 1) * 128; 490 + 491 + if (bytes + track->cb_color_tile_offset[i] > 492 + radeon_bo_size(track->cb_color_tile_bo[i])) { 493 + dev_warn(p->dev, "%s CMASK_BLOCK_MAX too large " 494 + "(block_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n", 495 + __func__, block_max, bytes, 496 + track->cb_color_tile_offset[i], 497 + radeon_bo_size(track->cb_color_tile_bo[i])); 498 + return -EINVAL; 499 + } 500 + break; 501 + } 502 + default: 503 + dev_warn(p->dev, "%s invalid tile mode\n", __func__); 504 + return -EINVAL; 505 + } 462 506 return 0; 463 507 } 464 508 ··· 612 566 613 567 ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; 614 568 nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; 615 - tmp = ntiles * bpe * 64 * nviews; 569 + tmp = ntiles * bpe * 64 * nviews * track->nsamples; 616 570 if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { 617 571 dev_warn(p->dev, "z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n", 618 572 array_mode, ··· 1277 1231 break; 1278 1232 case R_028C04_PA_SC_AA_CONFIG: 1279 1233 tmp = G_028C04_MSAA_NUM_SAMPLES(radeon_get_ib_value(p, idx)); 1234 + track->log_nsamples = tmp; 1280 1235 track->nsamples = 1 << tmp; 1281 1236 track->cb_dirty = true; 1282 1237 break; ··· 1359 1312 dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); 1360 1313 return -EINVAL; 1361 1314 } 1362 - ib[idx] = track->cb_color_base_last[tmp]; 1363 1315 track->cb_color_frag_bo[tmp] = track->cb_color_bo[tmp]; 1316 + track->cb_color_frag_offset[tmp] = track->cb_color_bo_offset[tmp]; 1317 + ib[idx] = track->cb_color_base_last[tmp]; 1364 1318 } else { 1365 1319 r = r600_cs_packet_next_reloc(p, &reloc); 1366 1320 if (r) { 1367 1321 dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); 1368 1322 return -EINVAL; 1369 1323 } 1370 - ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1371 1324 track->cb_color_frag_bo[tmp] = reloc->robj; 1325 + track->cb_color_frag_offset[tmp] = (u64)ib[idx] << 8; 1326 + ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1327 + } 1328 + if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { 1329 + track->cb_dirty = true; 1372 1330 } 1373 1331 break; 1374 1332 case R_0280C0_CB_COLOR0_TILE: ··· 1390 1338 dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); 1391 1339 return -EINVAL; 1392 1340 } 1393 - ib[idx] = track->cb_color_base_last[tmp]; 1394 1341 track->cb_color_tile_bo[tmp] = track->cb_color_bo[tmp]; 1342 + track->cb_color_tile_offset[tmp] = track->cb_color_bo_offset[tmp]; 1343 + ib[idx] = track->cb_color_base_last[tmp]; 1395 1344 } else { 1396 1345 r = r600_cs_packet_next_reloc(p, &reloc); 1397 1346 if (r) { 1398 1347 dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); 1399 1348 return -EINVAL; 1400 1349 } 1401 - ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1402 1350 track->cb_color_tile_bo[tmp] = reloc->robj; 1351 + track->cb_color_tile_offset[tmp] = (u64)ib[idx] << 8; 1352 + ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1353 + } 1354 + if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { 1355 + track->cb_dirty = true; 1356 + } 1357 + break; 1358 + case R_028100_CB_COLOR0_MASK: 1359 + case R_028104_CB_COLOR1_MASK: 1360 + case R_028108_CB_COLOR2_MASK: 1361 + case R_02810C_CB_COLOR3_MASK: 1362 + case R_028110_CB_COLOR4_MASK: 1363 + case R_028114_CB_COLOR5_MASK: 1364 + case R_028118_CB_COLOR6_MASK: 1365 + case R_02811C_CB_COLOR7_MASK: 1366 + tmp = (reg - R_028100_CB_COLOR0_MASK) / 4; 1367 + track->cb_color_mask[tmp] = ib[idx]; 1368 + if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { 1369 + track->cb_dirty = true; 1403 1370 } 1404 1371 break; 1405 1372 case CB_COLOR0_BASE: ··· 1563 1492 } 1564 1493 1565 1494 static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel, 1566 - unsigned w0, unsigned h0, unsigned d0, unsigned format, 1495 + unsigned w0, unsigned h0, unsigned d0, unsigned nsamples, unsigned format, 1567 1496 unsigned block_align, unsigned height_align, unsigned base_align, 1568 1497 unsigned *l0_size, unsigned *mipmap_size) 1569 1498 { ··· 1591 1520 1592 1521 depth = r600_mip_minify(d0, i); 1593 1522 1594 - size = nbx * nby * blocksize; 1523 + size = nbx * nby * blocksize * nsamples; 1595 1524 if (nfaces) 1596 1525 size *= nfaces; 1597 1526 else ··· 1743 1672 1744 1673 nfaces = larray - barray + 1; 1745 1674 } 1746 - r600_texture_size(nfaces, blevel, llevel, w0, h0, d0, format, 1675 + r600_texture_size(nfaces, blevel, llevel, w0, h0, d0, array_check.nsamples, format, 1747 1676 pitch_align, height_align, base_align, 1748 1677 &l0_size, &mipmap_size); 1749 1678 /* using get ib will give us the offset into the texture bo */
+17
drivers/gpu/drm/radeon/r600d.h
··· 92 92 #define R_028094_CB_COLOR5_VIEW 0x028094 93 93 #define R_028098_CB_COLOR6_VIEW 0x028098 94 94 #define R_02809C_CB_COLOR7_VIEW 0x02809C 95 + #define R_028100_CB_COLOR0_MASK 0x028100 96 + #define S_028100_CMASK_BLOCK_MAX(x) (((x) & 0xFFF) << 0) 97 + #define G_028100_CMASK_BLOCK_MAX(x) (((x) >> 0) & 0xFFF) 98 + #define C_028100_CMASK_BLOCK_MAX 0xFFFFF000 99 + #define S_028100_FMASK_TILE_MAX(x) (((x) & 0xFFFFF) << 12) 100 + #define G_028100_FMASK_TILE_MAX(x) (((x) >> 12) & 0xFFFFF) 101 + #define C_028100_FMASK_TILE_MAX 0x00000FFF 102 + #define R_028104_CB_COLOR1_MASK 0x028104 103 + #define R_028108_CB_COLOR2_MASK 0x028108 104 + #define R_02810C_CB_COLOR3_MASK 0x02810C 105 + #define R_028110_CB_COLOR4_MASK 0x028110 106 + #define R_028114_CB_COLOR5_MASK 0x028114 107 + #define R_028118_CB_COLOR6_MASK 0x028118 108 + #define R_02811C_CB_COLOR7_MASK 0x02811C 95 109 #define CB_COLOR0_INFO 0x280a0 96 110 # define CB_FORMAT(x) ((x) << 2) 97 111 # define CB_ARRAY_MODE(x) ((x) << 8) ··· 1414 1400 #define S_0280A0_TILE_MODE(x) (((x) & 0x3) << 18) 1415 1401 #define G_0280A0_TILE_MODE(x) (((x) >> 18) & 0x3) 1416 1402 #define C_0280A0_TILE_MODE 0xFFF3FFFF 1403 + #define V_0280A0_TILE_DISABLE 0 1404 + #define V_0280A0_CLEAR_ENABLE 1 1405 + #define V_0280A0_FRAG_ENABLE 2 1417 1406 #define S_0280A0_BLEND_CLAMP(x) (((x) & 0x1) << 20) 1418 1407 #define G_0280A0_BLEND_CLAMP(x) (((x) >> 20) & 0x1) 1419 1408 #define C_0280A0_BLEND_CLAMP 0xFFEFFFFF
-15
drivers/gpu/drm/radeon/radeon.h
··· 142 142 /* 143 143 * BIOS. 144 144 */ 145 - #define ATRM_BIOS_PAGE 4096 146 - 147 - #if defined(CONFIG_VGA_SWITCHEROO) 148 - bool radeon_atrm_supported(struct pci_dev *pdev); 149 - int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len); 150 - #else 151 - static inline bool radeon_atrm_supported(struct pci_dev *pdev) 152 - { 153 - return false; 154 - } 155 - 156 - static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){ 157 - return -EINVAL; 158 - } 159 - #endif 160 145 bool radeon_get_bios(struct radeon_device *rdev); 161 146 162 147 /*
+1 -1
drivers/gpu/drm/radeon/radeon_atombios.c
··· 452 452 } 453 453 454 454 /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ 455 - if ((dev->pdev->device == 0x9802) && 455 + if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) && 456 456 (dev->pdev->subsystem_vendor == 0x1734) && 457 457 (dev->pdev->subsystem_device == 0x11bd)) { 458 458 if (*connector_type == DRM_MODE_CONNECTOR_VGA) {
+1 -55
drivers/gpu/drm/radeon/radeon_atpx_handler.c
··· 30 30 /* handle for device - and atpx */ 31 31 acpi_handle dhandle; 32 32 acpi_handle atpx_handle; 33 - acpi_handle atrm_handle; 34 33 } radeon_atpx_priv; 35 - 36 - /* retrieve the ROM in 4k blocks */ 37 - static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, 38 - int offset, int len) 39 - { 40 - acpi_status status; 41 - union acpi_object atrm_arg_elements[2], *obj; 42 - struct acpi_object_list atrm_arg; 43 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; 44 - 45 - atrm_arg.count = 2; 46 - atrm_arg.pointer = &atrm_arg_elements[0]; 47 - 48 - atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; 49 - atrm_arg_elements[0].integer.value = offset; 50 - 51 - atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; 52 - atrm_arg_elements[1].integer.value = len; 53 - 54 - status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); 55 - if (ACPI_FAILURE(status)) { 56 - printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); 57 - return -ENODEV; 58 - } 59 - 60 - obj = (union acpi_object *)buffer.pointer; 61 - memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); 62 - len = obj->buffer.length; 63 - kfree(buffer.pointer); 64 - return len; 65 - } 66 - 67 - bool radeon_atrm_supported(struct pci_dev *pdev) 68 - { 69 - /* get the discrete ROM only via ATRM */ 70 - if (!radeon_atpx_priv.atpx_detected) 71 - return false; 72 - 73 - if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) 74 - return false; 75 - return true; 76 - } 77 - 78 - 79 - int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len) 80 - { 81 - return radeon_atrm_call(radeon_atpx_priv.atrm_handle, bios, offset, len); 82 - } 83 34 84 35 static int radeon_atpx_get_version(acpi_handle handle) 85 36 { ··· 149 198 150 199 static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) 151 200 { 152 - acpi_handle dhandle, atpx_handle, atrm_handle; 201 + acpi_handle dhandle, atpx_handle; 153 202 acpi_status status; 154 203 155 204 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); ··· 160 209 if (ACPI_FAILURE(status)) 161 210 return false; 162 211 163 - status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); 164 - if (ACPI_FAILURE(status)) 165 - return false; 166 - 167 212 radeon_atpx_priv.dhandle = dhandle; 168 213 radeon_atpx_priv.atpx_handle = atpx_handle; 169 - radeon_atpx_priv.atrm_handle = atrm_handle; 170 214 return true; 171 215 } 172 216
+134 -4
drivers/gpu/drm/radeon/radeon_bios.c
··· 32 32 33 33 #include <linux/vga_switcheroo.h> 34 34 #include <linux/slab.h> 35 + #include <linux/acpi.h> 35 36 /* 36 37 * BIOS. 37 38 */ ··· 99 98 return true; 100 99 } 101 100 101 + #ifdef CONFIG_ACPI 102 102 /* ATRM is used to get the BIOS on the discrete cards in 103 103 * dual-gpu systems. 104 104 */ 105 + /* retrieve the ROM in 4k blocks */ 106 + #define ATRM_BIOS_PAGE 4096 107 + /** 108 + * radeon_atrm_call - fetch a chunk of the vbios 109 + * 110 + * @atrm_handle: acpi ATRM handle 111 + * @bios: vbios image pointer 112 + * @offset: offset of vbios image data to fetch 113 + * @len: length of vbios image data to fetch 114 + * 115 + * Executes ATRM to fetch a chunk of the discrete 116 + * vbios image on PX systems (all asics). 117 + * Returns the length of the buffer fetched. 118 + */ 119 + static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, 120 + int offset, int len) 121 + { 122 + acpi_status status; 123 + union acpi_object atrm_arg_elements[2], *obj; 124 + struct acpi_object_list atrm_arg; 125 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; 126 + 127 + atrm_arg.count = 2; 128 + atrm_arg.pointer = &atrm_arg_elements[0]; 129 + 130 + atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; 131 + atrm_arg_elements[0].integer.value = offset; 132 + 133 + atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; 134 + atrm_arg_elements[1].integer.value = len; 135 + 136 + status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); 137 + if (ACPI_FAILURE(status)) { 138 + printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); 139 + return -ENODEV; 140 + } 141 + 142 + obj = (union acpi_object *)buffer.pointer; 143 + memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); 144 + len = obj->buffer.length; 145 + kfree(buffer.pointer); 146 + return len; 147 + } 148 + 105 149 static bool radeon_atrm_get_bios(struct radeon_device *rdev) 106 150 { 107 151 int ret; 108 152 int size = 256 * 1024; 109 153 int i; 154 + struct pci_dev *pdev = NULL; 155 + acpi_handle dhandle, atrm_handle; 156 + acpi_status status; 157 + bool found = false; 110 158 111 - if (!radeon_atrm_supported(rdev->pdev)) 159 + /* ATRM is for the discrete card only */ 160 + if (rdev->flags & RADEON_IS_IGP) 161 + return false; 162 + 163 + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { 164 + dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 165 + if (!dhandle) 166 + continue; 167 + 168 + status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); 169 + if (!ACPI_FAILURE(status)) { 170 + found = true; 171 + break; 172 + } 173 + } 174 + 175 + if (!found) 112 176 return false; 113 177 114 178 rdev->bios = kmalloc(size, GFP_KERNEL); ··· 183 117 } 184 118 185 119 for (i = 0; i < size / ATRM_BIOS_PAGE; i++) { 186 - ret = radeon_atrm_get_bios_chunk(rdev->bios, 187 - (i * ATRM_BIOS_PAGE), 188 - ATRM_BIOS_PAGE); 120 + ret = radeon_atrm_call(atrm_handle, 121 + rdev->bios, 122 + (i * ATRM_BIOS_PAGE), 123 + ATRM_BIOS_PAGE); 189 124 if (ret < ATRM_BIOS_PAGE) 190 125 break; 191 126 } ··· 197 130 } 198 131 return true; 199 132 } 133 + #else 134 + static inline bool radeon_atrm_get_bios(struct radeon_device *rdev) 135 + { 136 + return false; 137 + } 138 + #endif 200 139 201 140 static bool ni_read_disabled_bios(struct radeon_device *rdev) 202 141 { ··· 549 476 return legacy_read_disabled_bios(rdev); 550 477 } 551 478 479 + #ifdef CONFIG_ACPI 480 + static bool radeon_acpi_vfct_bios(struct radeon_device *rdev) 481 + { 482 + bool ret = false; 483 + struct acpi_table_header *hdr; 484 + acpi_size tbl_size; 485 + UEFI_ACPI_VFCT *vfct; 486 + GOP_VBIOS_CONTENT *vbios; 487 + VFCT_IMAGE_HEADER *vhdr; 488 + 489 + if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size))) 490 + return false; 491 + if (tbl_size < sizeof(UEFI_ACPI_VFCT)) { 492 + DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n"); 493 + goto out_unmap; 494 + } 495 + 496 + vfct = (UEFI_ACPI_VFCT *)hdr; 497 + if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) > tbl_size) { 498 + DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n"); 499 + goto out_unmap; 500 + } 501 + 502 + vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset); 503 + vhdr = &vbios->VbiosHeader; 504 + DRM_INFO("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n", 505 + vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction, 506 + vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength); 507 + 508 + if (vhdr->PCIBus != rdev->pdev->bus->number || 509 + vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) || 510 + vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) || 511 + vhdr->VendorID != rdev->pdev->vendor || 512 + vhdr->DeviceID != rdev->pdev->device) { 513 + DRM_INFO("ACPI VFCT table is not for this card\n"); 514 + goto out_unmap; 515 + }; 516 + 517 + if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) { 518 + DRM_ERROR("ACPI VFCT image truncated\n"); 519 + goto out_unmap; 520 + } 521 + 522 + rdev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL); 523 + ret = !!rdev->bios; 524 + 525 + out_unmap: 526 + return ret; 527 + } 528 + #else 529 + static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev) 530 + { 531 + return false; 532 + } 533 + #endif 552 534 553 535 bool radeon_get_bios(struct radeon_device *rdev) 554 536 { ··· 611 483 uint16_t tmp; 612 484 613 485 r = radeon_atrm_get_bios(rdev); 486 + if (r == false) 487 + r = radeon_acpi_vfct_bios(rdev); 614 488 if (r == false) 615 489 r = igp_read_bios_from_vram(rdev); 616 490 if (r == false)
+2 -1
drivers/gpu/drm/radeon/radeon_drv.c
··· 62 62 * 2.18.0 - r600-eg: allow "invalid" DB formats 63 63 * 2.19.0 - r600-eg: MSAA textures 64 64 * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query 65 + * 2.21.0 - r600-r700: FMASK and CMASK 65 66 */ 66 67 #define KMS_DRIVER_MAJOR 2 67 - #define KMS_DRIVER_MINOR 20 68 + #define KMS_DRIVER_MINOR 21 68 69 #define KMS_DRIVER_PATCHLEVEL 0 69 70 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 70 71 int radeon_driver_unload_kms(struct drm_device *dev);
+1 -2
drivers/gpu/drm/radeon/radeon_object.c
··· 132 132 acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, 133 133 sizeof(struct radeon_bo)); 134 134 135 + retry: 135 136 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); 136 137 if (bo == NULL) 137 138 return -ENOMEM; ··· 146 145 bo->surface_reg = -1; 147 146 INIT_LIST_HEAD(&bo->list); 148 147 INIT_LIST_HEAD(&bo->va); 149 - 150 - retry: 151 148 radeon_ttm_placement_from_domain(bo, domain); 152 149 /* Kernel allocation are uninterruptible */ 153 150 down_read(&rdev->pm.mclk_lock);
+1
drivers/gpu/drm/radeon/radeon_ring.c
··· 706 706 if (radeon_debugfs_ring_init(rdev, ring)) { 707 707 DRM_ERROR("Failed to register debugfs file for rings !\n"); 708 708 } 709 + radeon_ring_lockup_update(ring); 709 710 return 0; 710 711 } 711 712
-8
drivers/gpu/drm/radeon/reg_srcs/r600
··· 744 744 0x00028C38 CB_CLRCMP_DST 745 745 0x00028C3C CB_CLRCMP_MSK 746 746 0x00028C34 CB_CLRCMP_SRC 747 - 0x00028100 CB_COLOR0_MASK 748 - 0x00028104 CB_COLOR1_MASK 749 - 0x00028108 CB_COLOR2_MASK 750 - 0x0002810C CB_COLOR3_MASK 751 - 0x00028110 CB_COLOR4_MASK 752 - 0x00028114 CB_COLOR5_MASK 753 - 0x00028118 CB_COLOR6_MASK 754 - 0x0002811C CB_COLOR7_MASK 755 747 0x00028808 CB_COLOR_CONTROL 756 748 0x0002842C CB_FOG_BLUE 757 749 0x00028428 CB_FOG_GREEN