hc
2024-03-26 e0728245c89800c2038c23308f2d88969d5b41c8
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
95
96
97
98
99
100
101
102
103
104
/** @file
*
*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
*  Copyright (c) 2018, Linaro Limited. All rights reserved.
*
*  SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
 
#ifndef GENERIC_HARDWARE_ERROR_SOURCE
#define GENERIC_HARDWARE_ERROR_SOURCE
#include "Apei.h"
 
 
typedef struct {
  UINT64 AckRegister;
  UINT64 ErrorStatusBlockAddress;
} GHES_REGISTER;
 
typedef enum {
  PROCESSOR_GENERIC   = 0,
  PROCESSOR_IA32_X64  = 1,
  PROCESSOR_IPF       = 2,
  PROCESSOR_ARM       = 3,
  PLATFORM_MEMORY     = 4,
  PLATFORM_MEMORY2    = 5,
  PCIE_EXPRESS        = 6,
  FIRMWARE_ERROR      = 7,
  PCI_BUS             = 8,
  PCI_COMPONENT       = 9
} EFI_CPER_SECTION_TYPE;
typedef enum {
  RECOVERABLE = 0,
  FATAL = 1,
  CORRECTED = 2,
  NONE = 3
} ERROR_SEVERITY;
 
EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE*
ErrorBlockInitial(
  VOID   *Block,
  UINT32 Severity
);
BOOLEAN ErrorBlockAddErrorData (
  IN VOID                  *ErrorBlock,
  IN UINT32                MaxBlockLength,
  IN EFI_CPER_SECTION_TYPE TypeOfErrorData,
  IN VOID                  *GenericErrorData,
  IN UINT32                SizeOfGenericErrorData,
  IN ERROR_SEVERITY        ErrorSeverity,
  IN BOOLEAN               Correctable
);
BOOLEAN ErrorBlockAddErrorData (
  IN VOID                  *ErrorBlock,
  IN UINT32                MaxBlockLength,
  IN EFI_CPER_SECTION_TYPE TypeOfErrorData,
  IN VOID                  *GenericErrorData,
  IN UINT32                SizeOfGenericErrorData,
  IN ERROR_SEVERITY        ErrorSeverity,
  IN BOOLEAN               Correctable
);
 
VOID
GhesV2Initial (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE  *GhesV2,
  UINT32                                                          BlockLength
);
 
/**
@param type - one of HARDWARE_ERROR_NOTIFICATION Type, GSIV For ARM,and SCI for X86,
              Notice: Windows OS hadn't support to GSIV, 20171026
*/
VOID
GhesV2AddNotification (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE  *This,
  UINT8                                                           Type
);
 
 
EFI_STATUS
GhesV2LinkErrorBlock (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE *GhesV2,
  GHES_REGISTER                                                  *Register,
  VOID                                                           *ErrorBlock
);
VOID
GhesV1Initial (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE *GhesV1,
  UINT32                                               BlockLength
);
VOID
GhesV1AddNotification (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE *This,
  UINT8                                                Type
);
EFI_STATUS
GhesV1LinkErrorBlock (
  EFI_ACPI_6_1_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE *This,
  UINT64                                               *ptrBlockAddress,
  VOID                                                 *ErrorBlock
);
 
 
#endif