1 /*
2  *  Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef HEXAGON_TARGET_ELF_H
19 #define HEXAGON_TARGET_ELF_H
20 
cpu_get_model(uint32_t eflags)21 static inline const char *cpu_get_model(uint32_t eflags)
22 {
23     static char buf[32];
24     int err;
25 
26     /* For now, treat anything newer than v5 as a v73 */
27     /* FIXME - Disable instructions that are newer than the specified arch */
28     if (eflags == 0x04 ||    /* v5  */
29         eflags == 0x05 ||    /* v55 */
30         eflags == 0x60 ||    /* v60 */
31         eflags == 0x61 ||    /* v61 */
32         eflags == 0x62 ||    /* v62 */
33         eflags == 0x65 ||    /* v65 */
34         eflags == 0x66 ||    /* v66 */
35         eflags == 0x67 ||    /* v67 */
36         eflags == 0x8067 ||  /* v67t */
37         eflags == 0x68 ||    /* v68 */
38         eflags == 0x69 ||    /* v69 */
39         eflags == 0x71 ||    /* v71 */
40         eflags == 0x8071 ||  /* v71t */
41         eflags == 0x73       /* v73 */
42        ) {
43         return "v73";
44     }
45 
46     err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
47     return err >= 0 && err < sizeof(buf) ? buf : "unknown";
48 }
49 
50 #endif
51