|
21 | 21 | #include <stdint.h> |
22 | 22 |
|
23 | 23 | struct msm_id_struct { |
24 | | - uint64_t id; |
| 24 | + uint64_t chip_id; |
25 | 25 | const char *name; |
26 | 26 | }; |
27 | 27 |
|
28 | | -#define GetHundredDigit(coreid) (coreid / 100) |
29 | | -#define GetHundred(coreid) (GetHundredDigit(coreid) * 100) |
30 | | -#define GetTenDigit(coreid) ((coreid - GetHundred(coreid)) / 10) |
31 | | -#define GetTen(coreid) (GetTenDigit(coreid) * 10) |
32 | | -#define GetOneDigit(coreid) (coreid - (GetHundred(coreid) + GetTen(coreid))) |
33 | | - |
34 | | -#define CHIPID(coreid) \ |
35 | | - (GetHundredDigit(coreid) << 24) | \ |
36 | | - (GetTenDigit(coreid) << 16) | \ |
37 | | - (GetOneDigit(coreid) << 8) |
38 | | - |
39 | 28 | static const struct msm_id_struct msm_ids[] = { |
40 | | - // Adreno 2xx |
41 | | - {CHIPID(200), "Adreno 200"}, |
42 | | - {CHIPID(201), "Adreno 201"}, |
43 | | - {CHIPID(205), "Adreno 205"}, |
44 | | - {CHIPID(220), "Adreno 220"}, |
45 | | - |
46 | | - // Adreno 3xx |
47 | | - {CHIPID(305), "Adreno 305"}, |
48 | | - {CHIPID(307), "Adreno 307"}, |
49 | | - {CHIPID(320), "Adreno 320"}, |
50 | | - {CHIPID(330), "Adreno 330"}, |
| 29 | + { 0x20000ff, "FD200" }, |
| 30 | + { 0x20001ff, "FD201" }, |
| 31 | + { 0x20005ff, "FD205" }, |
| 32 | + { 0x20200ff, "FD220" }, |
| 33 | + { 0x30005ff, "FD305" }, |
| 34 | + { 0x30007ff, "FD307" }, |
| 35 | + { 0x30200ff, "FD320" }, |
| 36 | + { 0x30300ff, "FD330" }, |
| 37 | + { 0x3000512, "FD305B" }, |
| 38 | + { 0x3000620, "FD306A" }, |
| 39 | + { 0x40005ff, "FD405" }, |
| 40 | + { 0x40200ff, "FD420" }, |
| 41 | + { 0x40300ff, "FD430" }, |
| 42 | + { 0x50005ff, "FD505" }, |
| 43 | + { 0x50006ff, "FD506" }, |
| 44 | + { 0x50008ff, "FD508" }, |
| 45 | + { 0x50009ff, "FD509" }, |
| 46 | + { 0x50100ff, "FD510" }, |
| 47 | + { 0x50102ff, "FD512" }, |
| 48 | + { 0x50300ff, "FD530" }, |
| 49 | + { 0x50400ff, "FD540" }, |
| 50 | + { 0x60005ff, "FD605" }, |
| 51 | + { 0x60008ff, "FD608" }, |
| 52 | + { 0x60100ff, "FD610" }, |
| 53 | + { 0x60102ff, "FD612" }, |
| 54 | + { 0x60105ff, "FD615" }, |
| 55 | + { 0x60106ff, "FD616" }, |
| 56 | + { 0x60108ff, "FD618" }, |
| 57 | + { 0x60109ff, "FD619" }, |
| 58 | + { 0x60200ff, "FD620" }, |
| 59 | + { 0xffff06020100, "FD621" }, |
| 60 | + { 0xffff06020300, "Adreno623" }, |
| 61 | + { 0x60300ff, "FD630" }, |
| 62 | + { 0x60400ff, "FD640" }, |
| 63 | + { 0x60800ff, "FD680" }, |
| 64 | + { 0x60500ff, "FD650" }, |
| 65 | + { 0xbe06030500, "Adreno 8c Gen 3" }, |
| 66 | + { 0x7506030500, "Adreno 7c+ Gen 3" }, |
| 67 | + { 0x6006030500, "Adreno 7c+ Gen 3 Lite" }, |
| 68 | + { 0xac06030500, "FD643" }, |
| 69 | + { 0xffff06030500, "Adreno 7c+ Gen 3" }, |
| 70 | + { 0x60600ff, "FD660" }, |
| 71 | + { 0x6060201, "FD644" }, |
| 72 | + { 0xffff06060300, "FD663" }, |
| 73 | + { 0x60900ff, "FD690" }, |
| 74 | + { 0xffff06090000, "FD690" }, |
| 75 | + { 0x70002ff, "FD702" }, |
| 76 | + { 0xb207002000, "FD702" }, |
| 77 | + { 0xffff07002000, "FD702" }, |
| 78 | + { 0x7030002, "FD725" }, |
| 79 | + { 0xffff07030002, "FD725" }, |
| 80 | + { 0x7030001, "FD730" }, |
| 81 | + { 0xffff07030001, "FD730" }, |
| 82 | + { 0xffff43030c00, "Adreno X1-45" }, |
| 83 | + { 0x43030b00, "FD735" }, |
| 84 | + { 0x70400ff, "FD740" }, |
| 85 | + { 0x43050a01, "FD740" }, |
| 86 | + { 0xffff43050a01, "FD740" }, |
| 87 | + { 0xffff43050c01, "Adreno X1-85" }, |
| 88 | + { 0x43050a00, "FDA32" }, |
| 89 | + { 0xffff43050a00, "FDA32" }, |
| 90 | + { 0x43050b00, "FD740v3" }, |
| 91 | + { 0xffff43050b00, "FD740v3" }, |
| 92 | + { 0x43051401, "FD750" }, |
| 93 | + { 0xffff43051401, "FD750" }, |
| 94 | + { 0x44050000, "Adreno (TM) 830" }, |
| 95 | + { 0x44050001, "Adreno (TM) 830" }, |
| 96 | + { 0xffff44050a31, "Adreno (TM) 840" }, |
| 97 | + { 0xffff44070041, "Adreno (TM) X2-85" }, |
| 98 | +}; |
51 | 99 |
|
52 | | - // Adreno 4xx |
53 | | - {CHIPID(405), "Adreno 405"}, |
54 | | - {CHIPID(420), "Adreno 420"}, |
55 | | - {CHIPID(430), "Adreno 430"}, |
| 100 | +const char * msm_parse_marketing_name(uint64_t chip_id); |
56 | 101 |
|
57 | | - // Adreno 5xx |
58 | | - {CHIPID(508), "Adreno 508"}, |
59 | | - {CHIPID(509), "Adreno 509"}, |
60 | | - {CHIPID(510), "Adreno 510"}, |
61 | | - {CHIPID(512), "Adreno 512"}, |
62 | | - {CHIPID(530), "Adreno 530"}, |
63 | | - {CHIPID(540), "Adreno 540"}, |
| 102 | +const char * msm_parse_marketing_name(uint64_t chip_id) { |
| 103 | + for (unsigned i = 0; i < ARRAY_SIZE(msm_ids); i++) { |
| 104 | + /* Reference entry from device table: */ |
| 105 | + const struct msm_id_struct *ref = &msm_ids[i]; |
64 | 106 |
|
65 | | - // Adreno 6xx |
66 | | - {CHIPID(615), "Adreno 615"}, |
67 | | - {CHIPID(616), "Adreno 616"}, |
68 | | - {CHIPID(618), "Adreno 618"}, |
69 | | - {CHIPID(619), "Adreno 619"}, |
70 | | - {CHIPID(620), "Adreno 620"}, |
71 | | - {CHIPID(630), "Adreno 630"}, |
72 | | - {CHIPID(640), "Adreno 640"}, |
73 | | - // QCM6490 |
74 | | - {0x00ac06030500, "Adreno 643"}, |
75 | | - {CHIPID(650), "Adreno 650"}, |
76 | | - {CHIPID(660), "Adreno 660"}, |
77 | | - {CHIPID(680), "Adreno 680"}, |
78 | | - {CHIPID(690), "Adreno 690"}, |
79 | | - // no-speedbin Adreno 690 |
80 | | - {0xffff06090000, "Adreno 690"}, |
| 107 | + /* Match on either: |
| 108 | + * (a) exact match: |
| 109 | + */ |
| 110 | + if (ref->chip_id == chip_id) |
| 111 | + return ref->name; |
81 | 112 |
|
82 | | - // Adreno 7xx |
83 | | - {CHIPID(730), "Adreno 730"}, |
84 | | - {CHIPID(740), "Adreno 740"}, |
85 | | - {CHIPID(750), "Adreno 750"}, |
86 | | - {CHIPID(790), "Adreno 750"}, |
| 113 | + /* (b) device table entry has 0xff wildcard patch_id and core/ |
| 114 | + * major/minor match: |
| 115 | + */ |
| 116 | + if (((ref->chip_id & 0xff) == 0xff) && |
| 117 | + ((ref->chip_id & UINT64_C(0xffffff00)) == |
| 118 | + (chip_id & UINT64_C(0xffffff00)))) |
| 119 | + return ref->name; |
87 | 120 |
|
88 | | - // Misc |
89 | | - {0x00be06030500, "Adreno 8c Gen 3"}, |
90 | | - {0x007506030500, "Adreno 7c+ Gen 3"}, |
91 | | - {0x006006030500, "Adreno 7c+ Gen 3 Lite"}, |
92 | | - {0x000043051401, "Adreno 750"}, |
93 | | -}; |
| 121 | + #define WILDCARD_FUSE_ID UINT64_C(0x0000ffff00000000) |
| 122 | + /* If the reference id has wildcard fuse-id value (ie. bits 47..32 |
| 123 | + * are all ones, then try matching ignoring the device fuse-id: |
| 124 | + */ |
| 125 | + if ((ref->chip_id & WILDCARD_FUSE_ID) == WILDCARD_FUSE_ID) { |
| 126 | + uint64_t new_chip_id = chip_id | WILDCARD_FUSE_ID; |
94 | 127 |
|
95 | | -const char * msm_parse_marketing_name(uint64_t gpu_id); |
| 128 | + /* (c) exact match (ignoring the fuse-id from kernel): |
| 129 | + */ |
| 130 | + if (ref->chip_id == new_chip_id) |
| 131 | + return ref->name; |
96 | 132 |
|
97 | | -const char * msm_parse_marketing_name(uint64_t gpu_id) { |
98 | | - for (unsigned i = 0; i < ARRAY_SIZE(msm_ids); i++) { |
99 | | - if (gpu_id == msm_ids[i].id) { |
100 | | - return msm_ids[i].name; |
| 133 | + /* (d) device table entry has 0xff wildcard patch_id and core/ |
| 134 | + * major/minor match (ignoring fuse-id from kernel): |
| 135 | + */ |
| 136 | + if (((ref->chip_id & 0xff) == 0xff) && |
| 137 | + ((ref->chip_id & UINT64_C(0xffffff00)) == |
| 138 | + (new_chip_id & UINT64_C(0xffffff00)))) |
| 139 | + return ref->name; |
101 | 140 | } |
102 | 141 | } |
103 | 142 |
|
|
0 commit comments