Commit 88dd0b18 authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Alex Deucher

drm/amdgpu: Fix do not add new typedefs in amdgpu_fw_attestation.c

Fixes the following to align to coding style:

WARNING: do not add new typedefs
+typedef struct FW_ATT_DB_HEADER

WARNING: do not add new typedefs
+typedef struct FW_ATT_RECORD

WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
+                           S_IRUSR,

ERROR: "(foo*)" should be "(foo *)"
WARNING: please, no space before tabs

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b25b3599
...@@ -32,17 +32,15 @@ ...@@ -32,17 +32,15 @@
#include "soc15_common.h" #include "soc15_common.h"
#define FW_ATTESTATION_DB_COOKIE 0x143b6a37 #define FW_ATTESTATION_DB_COOKIE 0x143b6a37
#define FW_ATTESTATION_RECORD_VALID 1 #define FW_ATTESTATION_RECORD_VALID 1
#define FW_ATTESTATION_MAX_SIZE 4096 #define FW_ATTESTATION_MAX_SIZE 4096
typedef struct FW_ATT_DB_HEADER struct FW_ATT_DB_HEADER {
{
uint32_t AttDbVersion; /* version of the fwar feature */ uint32_t AttDbVersion; /* version of the fwar feature */
uint32_t AttDbCookie; /* cookie as an extra check for corrupt data */ uint32_t AttDbCookie; /* cookie as an extra check for corrupt data */
} FW_ATT_DB_HEADER; };
typedef struct FW_ATT_RECORD struct FW_ATT_RECORD {
{
uint16_t AttFwIdV1; /* Legacy FW Type field */ uint16_t AttFwIdV1; /* Legacy FW Type field */
uint16_t AttFwIdV2; /* V2 FW ID field */ uint16_t AttFwIdV2; /* V2 FW ID field */
uint32_t AttFWVersion; /* FW Version */ uint32_t AttFWVersion; /* FW Version */
...@@ -50,7 +48,7 @@ typedef struct FW_ATT_RECORD ...@@ -50,7 +48,7 @@ typedef struct FW_ATT_RECORD
uint8_t AttSource; /* FW source indicator */ uint8_t AttSource; /* FW source indicator */
uint8_t RecordValid; /* Indicates whether the record is a valid entry */ uint8_t RecordValid; /* Indicates whether the record is a valid entry */
uint32_t AttFwTaId; /* Ta ID (only in TA Attestation Table) */ uint32_t AttFwTaId; /* Ta ID (only in TA Attestation Table) */
} FW_ATT_RECORD; };
static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f, static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
char __user *buf, char __user *buf,
...@@ -60,15 +58,15 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f, ...@@ -60,15 +58,15 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private; struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
uint64_t records_addr = 0; uint64_t records_addr = 0;
uint64_t vram_pos = 0; uint64_t vram_pos = 0;
FW_ATT_DB_HEADER fw_att_hdr = {0}; struct FW_ATT_DB_HEADER fw_att_hdr = {0};
FW_ATT_RECORD fw_att_record = {0}; struct FW_ATT_RECORD fw_att_record = {0};
if (size < sizeof(FW_ATT_RECORD)) { if (size < sizeof(struct FW_ATT_RECORD)) {
DRM_WARN("FW attestation input buffer not enough memory"); DRM_WARN("FW attestation input buffer not enough memory");
return -EINVAL; return -EINVAL;
} }
if ((*pos + sizeof(FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) { if ((*pos + sizeof(struct FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) {
DRM_WARN("FW attestation out of bounds"); DRM_WARN("FW attestation out of bounds");
return 0; return 0;
} }
...@@ -83,8 +81,8 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f, ...@@ -83,8 +81,8 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
if (*pos == 0) { if (*pos == 0) {
amdgpu_device_vram_access(adev, amdgpu_device_vram_access(adev,
vram_pos, vram_pos,
(uint32_t*)&fw_att_hdr, (uint32_t *)&fw_att_hdr,
sizeof(FW_ATT_DB_HEADER), sizeof(struct FW_ATT_DB_HEADER),
false); false);
if (fw_att_hdr.AttDbCookie != FW_ATTESTATION_DB_COOKIE) { if (fw_att_hdr.AttDbCookie != FW_ATTESTATION_DB_COOKIE) {
...@@ -96,20 +94,20 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f, ...@@ -96,20 +94,20 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
} }
amdgpu_device_vram_access(adev, amdgpu_device_vram_access(adev,
vram_pos + sizeof(FW_ATT_DB_HEADER) + *pos, vram_pos + sizeof(struct FW_ATT_DB_HEADER) + *pos,
(uint32_t*)&fw_att_record, (uint32_t *)&fw_att_record,
sizeof(FW_ATT_RECORD), sizeof(struct FW_ATT_RECORD),
false); false);
if (fw_att_record.RecordValid != FW_ATTESTATION_RECORD_VALID) if (fw_att_record.RecordValid != FW_ATTESTATION_RECORD_VALID)
return 0; return 0;
if (copy_to_user(buf, (void*)&fw_att_record, sizeof(FW_ATT_RECORD))) if (copy_to_user(buf, (void *)&fw_att_record, sizeof(struct FW_ATT_RECORD)))
return -EINVAL; return -EINVAL;
*pos += sizeof(FW_ATT_RECORD); *pos += sizeof(struct FW_ATT_RECORD);
return sizeof(FW_ATT_RECORD); return sizeof(struct FW_ATT_RECORD);
} }
static const struct file_operations amdgpu_fw_attestation_debugfs_ops = { static const struct file_operations amdgpu_fw_attestation_debugfs_ops = {
...@@ -136,7 +134,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev) ...@@ -136,7 +134,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev)
return; return;
debugfs_create_file("amdgpu_fw_attestation", debugfs_create_file("amdgpu_fw_attestation",
S_IRUSR, 0400,
adev_to_drm(adev)->primary->debugfs_root, adev_to_drm(adev)->primary->debugfs_root,
adev, adev,
&amdgpu_fw_attestation_debugfs_ops); &amdgpu_fw_attestation_debugfs_ops);
......
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