Commit 221577d6 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amdgpu: add an option to override IP discovery table from a file



If you set amdgpu.discovery=2 you can force the the driver to
fetch the IP discovery table from a file rather than from the
table shipped on the device.  This is useful for debugging and
for device bring up and emulation when the tables may be in flux.
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c90a7c70
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* *
*/ */
#include <linux/firmware.h>
#include "amdgpu.h" #include "amdgpu.h"
#include "amdgpu_discovery.h" #include "amdgpu_discovery.h"
#include "soc15_hw_ip.h" #include "soc15_hw_ip.h"
...@@ -67,6 +69,8 @@ ...@@ -67,6 +69,8 @@
#include "smuio_v11_0_6.h" #include "smuio_v11_0_6.h"
#include "smuio_v13_0.h" #include "smuio_v13_0.h"
MODULE_FIRMWARE("amdgpu/ip_discovery.bin");
#define mmRCC_CONFIG_MEMSIZE 0xde3 #define mmRCC_CONFIG_MEMSIZE 0xde3
#define mmMM_INDEX 0x0 #define mmMM_INDEX 0x0
#define mmMM_INDEX_HI 0x6 #define mmMM_INDEX_HI 0x6
...@@ -206,6 +210,7 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev) ...@@ -206,6 +210,7 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
struct binary_header *bhdr; struct binary_header *bhdr;
struct ip_discovery_header *ihdr; struct ip_discovery_header *ihdr;
struct gpu_info_header *ghdr; struct gpu_info_header *ghdr;
const struct firmware *fw;
uint16_t offset; uint16_t offset;
uint16_t size; uint16_t size;
uint16_t checksum; uint16_t checksum;
...@@ -216,10 +221,21 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev) ...@@ -216,10 +221,21 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
if (!adev->mman.discovery_bin) if (!adev->mman.discovery_bin)
return -ENOMEM; return -ENOMEM;
r = amdgpu_discovery_read_binary(adev, adev->mman.discovery_bin); if (amdgpu_discovery == 2) {
if (r) { r = request_firmware(&fw, "amdgpu/ip_discovery.bin", adev->dev);
DRM_ERROR("failed to read ip discovery binary\n"); if (r)
goto out; goto get_from_vram;
dev_info(adev->dev, "Using IP discovery from file\n");
memcpy((u8 *)adev->mman.discovery_bin, (u8 *)fw->data,
adev->mman.discovery_tmr_size);
release_firmware(fw);
} else {
get_from_vram:
r = amdgpu_discovery_read_binary(adev, adev->mman.discovery_bin);
if (r) {
DRM_ERROR("failed to read ip discovery binary\n");
goto out;
}
} }
bhdr = (struct binary_header *)adev->mman.discovery_bin; bhdr = (struct binary_header *)adev->mman.discovery_bin;
......
...@@ -628,7 +628,7 @@ module_param_named(mcbp, amdgpu_mcbp, int, 0444); ...@@ -628,7 +628,7 @@ module_param_named(mcbp, amdgpu_mcbp, int, 0444);
/** /**
* DOC: discovery (int) * DOC: discovery (int)
* Allow driver to discover hardware IP information from IP Discovery table at the top of VRAM. * Allow driver to discover hardware IP information from IP Discovery table at the top of VRAM.
* (-1 = auto (default), 0 = disabled, 1 = enabled) * (-1 = auto (default), 0 = disabled, 1 = enabled, 2 = use ip_discovery table from file)
*/ */
MODULE_PARM_DESC(discovery, MODULE_PARM_DESC(discovery,
"Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM"); "Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment