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