blob: 36056fc9f016ee12cbe42de6ccade380134f40cd [file] [log] [blame]
Taylor Simpsond2a56bd2021-02-07 23:46:20 -06001/*
Taylor Simpsonfc2622f2023-04-27 15:40:49 -07002 * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
Taylor Simpsond2a56bd2021-02-07 23:46:20 -06003 *
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
21static inline const char *cpu_get_model(uint32_t eflags)
22{
Matheus Tavares Bernardino31285882023-05-04 15:53:12 -030023 static char buf[32];
24 int err;
25
Taylor Simpsonfc2622f2023-04-27 15:40:49 -070026 /* For now, treat anything newer than v5 as a v73 */
Taylor Simpsond2a56bd2021-02-07 23:46:20 -060027 /* 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 */
Taylor Simpsonfc2622f2023-04-27 15:40:49 -070036 eflags == 0x8067 || /* v67t */
37 eflags == 0x68 || /* v68 */
38 eflags == 0x69 || /* v69 */
39 eflags == 0x71 || /* v71 */
40 eflags == 0x8071 || /* v71t */
41 eflags == 0x73 /* v73 */
Taylor Simpsond2a56bd2021-02-07 23:46:20 -060042 ) {
Taylor Simpsonfc2622f2023-04-27 15:40:49 -070043 return "v73";
Taylor Simpsond2a56bd2021-02-07 23:46:20 -060044 }
Matheus Tavares Bernardino31285882023-05-04 15:53:12 -030045
46 err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
47 return err >= 0 && err < sizeof(buf) ? buf : "unknown";
Taylor Simpsond2a56bd2021-02-07 23:46:20 -060048}
49
50#endif