[radeon-alex:amd-staging-drm-next 226/251] drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:494:25: sparse: cast to restricted __le16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   a0c072e23e6f2543a12009d312387356c870f14f
commit: ace1073bfa90b6ccc9c2d9959c3603008d656b3d [226/251] drm/amdgpu: add save restore list cntl gpm and srm firmware support
reproduce:
        # apt-get install sparse
        git checkout ace1073bfa90b6ccc9c2d9959c3603008d656b3d
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h:937:7: sparse: Using plain integer as NULL pointer
   drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h:941:7: sparse: Using plain integer as NULL pointer
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:339:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:339:28:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:339:28:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:408:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:409:46: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:410:59: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:411:64: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:412:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:413:46: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:414:58: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:415:63: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:416:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:417:46: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:418:58: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:419:63: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:421:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:462:36: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:463:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:473:35: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:474:40: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:484:35: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:485:40: sparse: cast to restricted __le32
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:494:25: sparse: cast to restricted __le16
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:495:25: sparse: cast to restricted __le16
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:499:36: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:500:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:502:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:504:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:506:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:508:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:510:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:512:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:514:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:516:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:518:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:528:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:530:57: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:535:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:537:53: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:550:36: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:551:41: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:563:17: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:565:17: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:577:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:577:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:577:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:584:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:584:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:584:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:591:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:591:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:591:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:598:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:598:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:598:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:626:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:632:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:632:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:632:25: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:641:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:646:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:646:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:646:33: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:712:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:712:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:712:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:713:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:713:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:713:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:715:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:715:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:715:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:716:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:716:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:716:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:717:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:717:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:717:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:722:49: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:722:49:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:722:49:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:724:49: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:724:49:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:724:49:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:727:57: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:727:57:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:727:57:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:734:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:734:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:734:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:735:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:735:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:735:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:737:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:737:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:737:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:738:25: sparse: incorrect type in assignment (different base types) @@    expected unsigned int volatile [unsigned] [usertype] <noident> @@    got latile [unsigned] [usertype] <noident> @@
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:738:25:    expected unsigned int volatile [unsigned] [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:738:25:    got restricted __le32 [usertype] <noident>
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:807:34: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:808:40: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:809:38: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:815:34: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:816:40: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:817:38: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:823:34: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:824:40: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:825:38: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:831:34: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:832:40: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:833:38: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:839:34: sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:840:40: sparse: cast to restricted __le32
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:841:38: sparse: too many warnings

vim +494 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

   402	
   403	static void gfx_v9_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
   404	{
   405		const struct rlc_firmware_header_v2_1 *rlc_hdr;
   406	
   407		rlc_hdr = (const struct rlc_firmware_header_v2_1 *)adev->gfx.rlc_fw->data;
   408		adev->gfx.rlc_srlc_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_ucode_ver);
   409		adev->gfx.rlc_srlc_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_feature_ver);
   410		adev->gfx.rlc.save_restore_list_cntl_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_cntl_size_bytes);
   411		adev->gfx.rlc.save_restore_list_cntl = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_cntl_offset_bytes);
   412		adev->gfx.rlc_srlg_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_ucode_ver);
   413		adev->gfx.rlc_srlg_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_feature_ver);
   414		adev->gfx.rlc.save_restore_list_gpm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_gpm_size_bytes);
   415		adev->gfx.rlc.save_restore_list_gpm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_gpm_offset_bytes);
   416		adev->gfx.rlc_srls_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_ucode_ver);
   417		adev->gfx.rlc_srls_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_feature_ver);
 > 418		adev->gfx.rlc.save_restore_list_srm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_srm_size_bytes);
   419		adev->gfx.rlc.save_restore_list_srm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_srm_offset_bytes);
   420		adev->gfx.rlc.reg_list_format_direct_reg_list_length =
   421				le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length);
   422	}
   423	
   424	static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
   425	{
   426		const char *chip_name;
   427		char fw_name[30];
   428		int err;
   429		struct amdgpu_firmware_info *info = NULL;
   430		const struct common_firmware_header *header = NULL;
   431		const struct gfx_firmware_header_v1_0 *cp_hdr;
   432		const struct rlc_firmware_header_v2_0 *rlc_hdr;
   433		unsigned int *tmp = NULL;
   434		unsigned int i = 0;
   435		uint16_t version_major;
   436		uint16_t version_minor;
   437	
   438		DRM_DEBUG("\n");
   439	
   440		switch (adev->asic_type) {
   441		case CHIP_VEGA10:
   442			chip_name = "vega10";
   443			break;
   444		case CHIP_VEGA12:
   445			chip_name = "vega12";
   446			break;
   447		case CHIP_RAVEN:
   448			chip_name = "raven";
   449			break;
   450		default:
   451			BUG();
   452		}
   453	
   454		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
   455		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
   456		if (err)
   457			goto out;
   458		err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
   459		if (err)
   460			goto out;
   461		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data;
   462		adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
   463		adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
   464	
   465		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
   466		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
   467		if (err)
   468			goto out;
   469		err = amdgpu_ucode_validate(adev->gfx.me_fw);
   470		if (err)
   471			goto out;
   472		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data;
   473		adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
   474		adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
   475	
   476		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
   477		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
   478		if (err)
   479			goto out;
   480		err = amdgpu_ucode_validate(adev->gfx.ce_fw);
   481		if (err)
   482			goto out;
   483		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data;
   484		adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
   485		adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
   486	
   487		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
   488		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
   489		if (err)
   490			goto out;
   491		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
   492		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
   493	
 > 494		version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
   495		version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
   496		if (version_major == 2 && version_minor == 1)
   497			adev->gfx.rlc.is_rlc_v2_1 = true;
   498	
   499		adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
   500		adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
   501		adev->gfx.rlc.save_and_restore_offset =
   502				le32_to_cpu(rlc_hdr->save_and_restore_offset);
   503		adev->gfx.rlc.clear_state_descriptor_offset =
   504				le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
   505		adev->gfx.rlc.avail_scratch_ram_locations =
   506				le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
   507		adev->gfx.rlc.reg_restore_list_size =
   508				le32_to_cpu(rlc_hdr->reg_restore_list_size);
   509		adev->gfx.rlc.reg_list_format_start =
   510				le32_to_cpu(rlc_hdr->reg_list_format_start);
   511		adev->gfx.rlc.reg_list_format_separate_start =
   512				le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
   513		adev->gfx.rlc.starting_offsets_start =
   514				le32_to_cpu(rlc_hdr->starting_offsets_start);
   515		adev->gfx.rlc.reg_list_format_size_bytes =
   516				le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
   517		adev->gfx.rlc.reg_list_size_bytes =
   518				le32_to_cpu(rlc_hdr->reg_list_size_bytes);
   519		adev->gfx.rlc.register_list_format =
   520				kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
   521					adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
   522		if (!adev->gfx.rlc.register_list_format) {
   523			err = -ENOMEM;
   524			goto out;
   525		}
   526	
   527		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
   528				le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
   529		for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
   530			adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
   531	
   532		adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
   533	
   534		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
   535				le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
   536		for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
   537			adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
   538	
   539		if (adev->gfx.rlc.is_rlc_v2_1)
   540			gfx_v9_0_init_rlc_ext_microcode(adev);
   541	
   542		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
   543		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
   544		if (err)
   545			goto out;
   546		err = amdgpu_ucode_validate(adev->gfx.mec_fw);
   547		if (err)
   548			goto out;
   549		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
   550		adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
   551		adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
   552	
   553	
   554		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
   555		err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
   556		if (!err) {
   557			err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
   558			if (err)
   559				goto out;
   560			cp_hdr = (const struct gfx_firmware_header_v1_0 *)
   561			adev->gfx.mec2_fw->data;
   562			adev->gfx.mec2_fw_version =
   563			le32_to_cpu(cp_hdr->header.ucode_version);
   564			adev->gfx.mec2_feature_version =
   565			le32_to_cpu(cp_hdr->ucode_feature_version);
   566		} else {
   567			err = 0;
   568			adev->gfx.mec2_fw = NULL;
   569		}
   570	
   571		if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
   572			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
   573			info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
   574			info->fw = adev->gfx.pfp_fw;
   575			header = (const struct common_firmware_header *)info->fw->data;
   576			adev->firmware.fw_size +=
   577				ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
   578	
   579			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
   580			info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
   581			info->fw = adev->gfx.me_fw;
   582			header = (const struct common_firmware_header *)info->fw->data;
   583			adev->firmware.fw_size +=
   584				ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
   585	
   586			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
   587			info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
   588			info->fw = adev->gfx.ce_fw;
   589			header = (const struct common_firmware_header *)info->fw->data;
   590			adev->firmware.fw_size +=
   591				ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
   592	
   593			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
   594			info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
   595			info->fw = adev->gfx.rlc_fw;
   596			header = (const struct common_firmware_header *)info->fw->data;
   597			adev->firmware.fw_size +=
   598				ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
   599	
   600			if (adev->gfx.rlc.is_rlc_v2_1) {
   601				info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL];
   602				info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL;
   603				info->fw = adev->gfx.rlc_fw;
   604				adev->firmware.fw_size +=
   605					ALIGN(adev->gfx.rlc.save_restore_list_cntl_size_bytes, PAGE_SIZE);
   606	
   607				info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM];
   608				info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM;
   609				info->fw = adev->gfx.rlc_fw;
   610				adev->firmware.fw_size +=
   611					ALIGN(adev->gfx.rlc.save_restore_list_gpm_size_bytes, PAGE_SIZE);
   612	
   613				info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM];
   614				info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM;
   615				info->fw = adev->gfx.rlc_fw;
   616				adev->firmware.fw_size +=
   617					ALIGN(adev->gfx.rlc.save_restore_list_srm_size_bytes, PAGE_SIZE);
   618			}
   619	
   620			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];
   621			info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
   622			info->fw = adev->gfx.mec_fw;
   623			header = (const struct common_firmware_header *)info->fw->data;
   624			cp_hdr = (const struct gfx_firmware_header_v1_0 *)info->fw->data;
   625			adev->firmware.fw_size +=
   626				ALIGN(le32_to_cpu(header->ucode_size_bytes) - le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
   627	
   628			info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1_JT];
   629			info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1_JT;
   630			info->fw = adev->gfx.mec_fw;
   631			adev->firmware.fw_size +=
   632				ALIGN(le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
   633	
   634			if (adev->gfx.mec2_fw) {
   635				info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];
   636				info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
   637				info->fw = adev->gfx.mec2_fw;
   638				header = (const struct common_firmware_header *)info->fw->data;
   639				cp_hdr = (const struct gfx_firmware_header_v1_0 *)info->fw->data;
   640				adev->firmware.fw_size +=
   641					ALIGN(le32_to_cpu(header->ucode_size_bytes) - le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
   642				info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2_JT];
   643				info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2_JT;
   644				info->fw = adev->gfx.mec2_fw;
   645				adev->firmware.fw_size +=
   646					ALIGN(le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
   647			}
   648	
   649		}
   650	
   651	out:
   652		if (err) {
   653			dev_err(adev->dev,
   654				"gfx9: Failed to load firmware \"%s\"\n",
   655				fw_name);
   656			release_firmware(adev->gfx.pfp_fw);
   657			adev->gfx.pfp_fw = NULL;
   658			release_firmware(adev->gfx.me_fw);
   659			adev->gfx.me_fw = NULL;
   660			release_firmware(adev->gfx.ce_fw);
   661			adev->gfx.ce_fw = NULL;
   662			release_firmware(adev->gfx.rlc_fw);
   663			adev->gfx.rlc_fw = NULL;
   664			release_firmware(adev->gfx.mec_fw);
   665			adev->gfx.mec_fw = NULL;
   666			release_firmware(adev->gfx.mec2_fw);
   667			adev->gfx.mec2_fw = NULL;
   668		}
   669		return err;
   670	}
   671	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux