-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhei_main.hpp
94 lines (86 loc) · 3.48 KB
/
hei_main.hpp
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* @file hei_main.hpp
*
* These are the primary APIs for Hardware Error Isolation (aka the isolator).
* The intended flow is to:
*
* - Call initialize() for each necessary Chip Data File.
*
* - Call isolate() for all chips that need error isolation.
*
* - Once isolation is no longer needed, call uninitialize() to free up
* resources used for isolation.
*
* Note that initialize() allocates many objects used for isolation and keeps
* them in memory. Its purpose is to avoid initializing the objects each time
* isolation is required. The data provided by the Chip Data Files is static.
* So reinitializing would be a waste of time, unless for some reason the Chip
* Data Files themselves are updated, which would require reinitialization
* anyway. Of course, leaving the object in memory chews up resources. So, some
* users may need to weigh performance vs. memory usage.
*
* If data for a specific chip type changes and needs to be reinitialized, the
* user application must reinitialize all chip data as follows:
*
* - Call uninitialize() to flush isolation objects for ALL chip types.
*
* - Call initialize() for ALL necessary Chip Data Files.
*/
#pragma once
#include <hei_chip.hpp>
#include <hei_isolation_data.hpp>
#include <vector>
namespace libhei
{
/**
* @brief Initializes all isolation objects based on data from the given Chip
* Data File.
*
* This function only takes one Chip Data File at a time. Therefore, the
* user application must call this function for each Chip Data File required
* for isolation.
*
* Storage and management of the Chip Data Files will vary per user application.
* Therefore, the user application is responsible for loading the Chip Data
* Files into memory as needed, and providing the location and size of the data.
*
* Once this function returns, the Chip Data File is no longer needed in memory.
*
* Details of the Chip Data File format can be found in CHIP_DATA.md.
*
* IMPORTANT:
* This function will build and store objects as it is parsing the Chip Data
* Files. It will assert:
* - Each file is the proper format and contains valid data.
* - No two files can share the same chip model/level.
* This ensures that the isolator does not use a partial (possibly invalid) or
* duplicate set of objects.
*
* @param i_buffer A pointer to the buffer containing a single Chip Data File.
*
* @param i_bufferSize The size (in bytes) of the target Chip Data File.
*/
void initialize(void* i_buffer, size_t i_bufferSize);
/**
* @brief Deletes all internal isolation objects that were created by
* initialize().
*/
void uninitialize();
/**
* @brief Isolates all active hardware errors found on the given list of chips.
*
* This functions will assert that initialize() has been called for each Chip
* Data File corresponding to the given chip types.
*
* @param i_chipList The list of all chips that need to be analyzed. Generally,
* this would include all processor and memory chips in the
* system.
*
* @param o_isoData Initially, all data in the object will be flushed and then
* repopulated with a list of all active hardware errors found
* on the given list of chips, the contents of any registers
* associated with the active errors, and any other data that
* can be useful for debug.
*/
void isolate(const std::vector<Chip>& i_chipList, IsolationData& o_isoData);
} // end namespace libhei