1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef _AMDGPU_RAS_EEPROM_H
25 #define _AMDGPU_RAS_EEPROM_H
26
27 #include <linux/i2c.h>
28
29 struct amdgpu_device;
30
31 enum amdgpu_ras_eeprom_err_type{
32 AMDGPU_RAS_EEPROM_ERR_PLACE_HOLDER,
33 AMDGPU_RAS_EEPROM_ERR_RECOVERABLE,
34 AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE
35 };
36
37 struct amdgpu_ras_eeprom_table_header {
38 uint32_t header;
39 uint32_t version;
40 uint32_t first_rec_offset;
41 uint32_t tbl_size;
42 uint32_t checksum;
43 }__attribute__((__packed__));
44
45 struct amdgpu_ras_eeprom_control {
46 struct amdgpu_ras_eeprom_table_header tbl_hdr;
47 struct i2c_adapter eeprom_accessor;
48 uint32_t next_addr;
49 unsigned int num_recs;
50 struct mutex tbl_mutex;
51 bool bus_locked;
52 uint32_t tbl_byte_sum;
53 };
54
55
56
57
58
59 struct eeprom_table_record {
60
61 union {
62 uint64_t address;
63 uint64_t offset;
64 };
65
66 uint64_t retired_page;
67 uint64_t ts;
68
69 enum amdgpu_ras_eeprom_err_type err_type;
70
71 union {
72 unsigned char bank;
73 unsigned char cu;
74 };
75
76 unsigned char mem_channel;
77 unsigned char mcumc_id;
78 }__attribute__((__packed__));
79
80 int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control);
81 void amdgpu_ras_eeprom_fini(struct amdgpu_ras_eeprom_control *control);
82
83 int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
84 struct eeprom_table_record *records,
85 bool write,
86 int num);
87
88 void amdgpu_ras_eeprom_test(struct amdgpu_ras_eeprom_control *control);
89
90 #endif