mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-26 21:52:20 +00:00
drm/amdgpu/discovery: check ip_discovery fw file available
Signed-off-by: Flora Cui <flora.cui@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
62c1ed0a64
commit
017fbb6690
@ -113,8 +113,7 @@
|
|||||||
#include "amdgpu_isp.h"
|
#include "amdgpu_isp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIRMWARE_IP_DISCOVERY "amdgpu/ip_discovery.bin"
|
MODULE_FIRMWARE("amdgpu/ip_discovery.bin");
|
||||||
MODULE_FIRMWARE(FIRMWARE_IP_DISCOVERY);
|
|
||||||
|
|
||||||
#define mmIP_DISCOVERY_VERSION 0x16A00
|
#define mmIP_DISCOVERY_VERSION 0x16A00
|
||||||
#define mmRCC_CONFIG_MEMSIZE 0xde3
|
#define mmRCC_CONFIG_MEMSIZE 0xde3
|
||||||
@ -297,21 +296,13 @@ static int amdgpu_discovery_read_binary_from_mem(struct amdgpu_device *adev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev, uint8_t *binary)
|
static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
|
||||||
|
uint8_t *binary,
|
||||||
|
const char *fw_name)
|
||||||
{
|
{
|
||||||
const struct firmware *fw;
|
const struct firmware *fw;
|
||||||
const char *fw_name;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
switch (amdgpu_discovery) {
|
|
||||||
case 2:
|
|
||||||
fw_name = FIRMWARE_IP_DISCOVERY;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_warn(adev->dev, "amdgpu_discovery is not set properly\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = request_firmware(&fw, fw_name, adev->dev);
|
r = request_firmware(&fw, fw_name, adev->dev);
|
||||||
if (r) {
|
if (r) {
|
||||||
dev_err(adev->dev, "can't load firmware \"%s\"\n",
|
dev_err(adev->dev, "can't load firmware \"%s\"\n",
|
||||||
@ -404,10 +395,19 @@ static int amdgpu_discovery_verify_npsinfo(struct amdgpu_device *adev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *amdgpu_discovery_get_fw_name(struct amdgpu_device *adev)
|
||||||
|
{
|
||||||
|
if (amdgpu_discovery == 2)
|
||||||
|
return "amdgpu/ip_discovery.bin";
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int amdgpu_discovery_init(struct amdgpu_device *adev)
|
static int amdgpu_discovery_init(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
struct table_info *info;
|
struct table_info *info;
|
||||||
struct binary_header *bhdr;
|
struct binary_header *bhdr;
|
||||||
|
const char *fw_name;
|
||||||
uint16_t offset;
|
uint16_t offset;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint16_t checksum;
|
uint16_t checksum;
|
||||||
@ -419,9 +419,10 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Read from file if it is the preferred option */
|
/* Read from file if it is the preferred option */
|
||||||
if (amdgpu_discovery == 2) {
|
fw_name = amdgpu_discovery_get_fw_name(adev);
|
||||||
|
if (fw_name != NULL) {
|
||||||
dev_info(adev->dev, "use ip discovery information from file");
|
dev_info(adev->dev, "use ip discovery information from file");
|
||||||
r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin);
|
r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin, fw_name);
|
||||||
|
|
||||||
if (r) {
|
if (r) {
|
||||||
dev_err(adev->dev, "failed to read ip discovery binary from file\n");
|
dev_err(adev->dev, "failed to read ip discovery binary from file\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user