Repository navigation
Expand file tree
/
Copy pathneuron_arch.h
More file actions
75 lines (64 loc) · 1.82 KB
/
Copy pathneuron_arch.h
File metadata and controls
75 lines (64 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright 2020, Amazon.com, Inc. or its affiliates. All Rights Reserved
*/
#ifndef NEURON_ARCH_H
#define NEURON_ARCH_H
#include <linux/bug.h>
#include <linux/types.h>
enum neuron_arch {
NEURON_ARCH_INVALID,
NEURON_ARCH_V2 = 2,
NEURON_ARCH_V3 = 3,
NEURON_ARCH_V4 = 4,
NEURON_ARCH_NUM
};
/**
* narch_init() - Set neuron devices architecture and revision.
*
* @arch: architecture of the neuron devices in this system
* @revision: revision id of the neuron devices in this system
*
* Return: 0 if read succeeds, a negative error code otherwise.
*/
void narch_init(enum neuron_arch arch, u8 revision);
/**
* narch_get_arch() - Get architecture of neuron devices present in the system.
*
* Return: architecture.
*/
enum neuron_arch narch_get_arch(void);
/**
* narch_get_revision() - Get revision id of neuron devices present in the system.
*
* Return: revision.
*/
u8 narch_get_revision(void);
/**
* narch_is_qemu() - Checks if running on qemu.
*
* Return: True if running on qemu.
*/
bool narch_is_qemu(void);
/**
* narch_is_emu() - Checks if running on hardware emulator.
*
* Return: True if running on emulator.
*/
bool narch_is_emu(void);
/**
* narch_get_instance_type_name() - Reads instance type name from device DMI data.
*
* @instance_type_name: Buffer to store the instance type name string.
* @instance_type_name_size: Size of the instance_type_name buffer.
*
* Note: This function is only available on kernel versions 5.10.0 and above.
*
* Return:
* * 0 if read succeeds,
* * -ENOMEM - Failed to allocate temporary buffer for reading.
* * -EIO - Failed to read the DMI product_name file.
* * -ENOSYS - Kernel version is below 5.10.0, function not supported.
*/
int narch_get_instance_type_name(char *instance_type_name, size_t instance_type_name_size);
#endif