diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-09-23 13:10:49 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:54:17 -0400 |
commit | 43bf11bd9231ad06bd1d91c847beda52b88bc6e0 (patch) | |
tree | c9a150fb340728c58a5d0324bda1b8d305124f71 /drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | |
parent | 0cdd500560e233aef4e0749c9f014e9ee8f4d752 (diff) |
drm/amdgpu: move atom scratch setup into amdgpu_atombios.c
There will be a slightly different version for atomfirmware.
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c index 56a86dd5789e..f52b1bf3d3d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | |||
@@ -1748,3 +1748,31 @@ void amdgpu_atombios_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le) | |||
1748 | memcpy(dst, src, num_bytes); | 1748 | memcpy(dst, src, num_bytes); |
1749 | #endif | 1749 | #endif |
1750 | } | 1750 | } |
1751 | |||
1752 | int amdgpu_atombios_allocate_fb_scratch(struct amdgpu_device *adev) | ||
1753 | { | ||
1754 | struct atom_context *ctx = adev->mode_info.atom_context; | ||
1755 | int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); | ||
1756 | uint16_t data_offset; | ||
1757 | int usage_bytes = 0; | ||
1758 | struct _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware_usage; | ||
1759 | |||
1760 | if (amdgpu_atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { | ||
1761 | firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); | ||
1762 | |||
1763 | DRM_DEBUG("atom firmware requested %08x %dkb\n", | ||
1764 | le32_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware), | ||
1765 | le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb)); | ||
1766 | |||
1767 | usage_bytes = le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb) * 1024; | ||
1768 | } | ||
1769 | ctx->scratch_size_bytes = 0; | ||
1770 | if (usage_bytes == 0) | ||
1771 | usage_bytes = 20 * 1024; | ||
1772 | /* allocate some scratch memory */ | ||
1773 | ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL); | ||
1774 | if (!ctx->scratch) | ||
1775 | return -ENOMEM; | ||
1776 | ctx->scratch_size_bytes = usage_bytes; | ||
1777 | return 0; | ||
1778 | } | ||