@@ -36,6 +36,22 @@ static void __inc_entry_length(struct cper_hdr *hdr, uint32_t size)
36
36
hdr -> record_length += size ;
37
37
}
38
38
39
+ static void amdgpu_cper_get_timestamp (struct cper_timestamp * timestamp )
40
+ {
41
+ struct tm tm ;
42
+ time64_t now = ktime_get_real_seconds ();
43
+
44
+ time64_to_tm (now , 0 , & tm );
45
+ timestamp -> seconds = tm .tm_sec ;
46
+ timestamp -> minutes = tm .tm_min ;
47
+ timestamp -> hours = tm .tm_hour ;
48
+ timestamp -> flag = 0 ;
49
+ timestamp -> day = tm .tm_mday ;
50
+ timestamp -> month = 1 + tm .tm_mon ;
51
+ timestamp -> year = (1900 + tm .tm_year ) % 100 ;
52
+ timestamp -> century = (1900 + tm .tm_year ) / 100 ;
53
+ }
54
+
39
55
void amdgpu_cper_entry_fill_hdr (struct amdgpu_device * adev ,
40
56
struct cper_hdr * hdr ,
41
57
enum amdgpu_cper_type type ,
@@ -52,7 +68,8 @@ void amdgpu_cper_entry_fill_hdr(struct amdgpu_device *adev,
52
68
hdr -> valid_bits .platform_id = 1 ;
53
69
hdr -> valid_bits .partition_id = 1 ;
54
70
hdr -> valid_bits .timestamp = 1 ;
55
- /*TODO need to initialize hdr->timestamp */
71
+
72
+ amdgpu_cper_get_timestamp (& hdr -> timestamp );
56
73
57
74
snprintf (hdr -> record_id , 8 , "%d" , atomic_inc_return (& adev -> cper .unique_id ));
58
75
snprintf (hdr -> platform_id , 16 , "0x%04X:0x%04X" ,
0 commit comments