xref: /illumos-gate/usr/src/boot/efi/include/Protocol/DriverDiagnostics2.h (revision f334afcfaebea1b7dc3430015651d8d748fa8a3e)
1 /** @file
2   UEFI Driver Diagnostics2 Protocol
3 
4   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef __EFI_DRIVER_DIAGNOSTICS2_H__
10 #define __EFI_DRIVER_DIAGNOSTICS2_H__
11 
12 #include <Protocol/DriverDiagnostics.h>
13 
14 #define EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID \
15   { \
16     0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } \
17   }
18 
19 typedef struct _EFI_DRIVER_DIAGNOSTICS2_PROTOCOL EFI_DRIVER_DIAGNOSTICS2_PROTOCOL;
20 
21 /**
22   Runs diagnostics on a controller.
23 
24   @param  This             A pointer to the EFI_DRIVER_DIAGNOSTICS2_PROTOCOL instance.
25   @param  ControllerHandle The handle of the controller to run diagnostics on.
26   @param  ChildHandle      The handle of the child controller to run diagnostics on
27                            This is an optional parameter that may be NULL.  It will
28                            be NULL for device drivers.  It will also be NULL for
29                            bus drivers that wish to run diagnostics on the bus
30                            controller.  It will not be NULL for a bus driver that
31                            wishes to run diagnostics on one of its child controllers.
32   @param  DiagnosticType   Indicates the type of diagnostics to perform on the controller
33                            specified by ControllerHandle and ChildHandle.   See
34                            "Related Definitions" for the list of supported types.
35   @param  Language         A pointer to a Null-terminated ASCII string
36                            array indicating the language. This is the
37                            language of the driver name that the caller
38                            is requesting, and it must match one of the
39                            languages specified in SupportedLanguages.
40                            The number of languages supported by a
41                            driver is up to the driver writer. Language
42                            is specified in RFC 4646 language code format.
43   @param  ErrorType        A GUID that defines the format of the data returned in Buffer.
44   @param  BufferSize       The size, in bytes, of the data returned in Buffer.
45   @param  Buffer           A buffer that contains a Null-terminated Unicode string
46                            plus some additional data whose format is defined by
47                            ErrorType.  Buffer is allocated by this function with
48                            AllocatePool(), and it is the caller's responsibility
49                            to free it with a call to FreePool().
50 
51   @retval EFI_SUCCESS           The controller specified by ControllerHandle and
52                                 ChildHandle passed the diagnostic.
53   @retval EFI_ACCESS_DENIED     The request for initiating diagnostics was unable
54                                 to be complete due to some underlying hardware or
55                                 software state.
56   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
57   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
58   @retval EFI_INVALID_PARAMETER Language is NULL.
59   @retval EFI_INVALID_PARAMETER ErrorType is NULL.
60   @retval EFI_INVALID_PARAMETER BufferType is NULL.
61   @retval EFI_INVALID_PARAMETER Buffer is NULL.
62   @retval EFI_UNSUPPORTED       The driver specified by This does not support
63                                 running diagnostics for the controller specified
64                                 by ControllerHandle and ChildHandle.
65   @retval EFI_UNSUPPORTED       The driver specified by This does not support the
66                                 type of diagnostic specified by DiagnosticType.
67   @retval EFI_UNSUPPORTED       The driver specified by This does not support the
68                                 language specified by Language.
69   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to complete
70                                 the diagnostics.
71   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to return
72                                 the status information in ErrorType, BufferSize,
73                                 and Buffer.
74   @retval EFI_DEVICE_ERROR      The controller specified by ControllerHandle and
75                                 ChildHandle did not pass the diagnostic.
76 
77 **/
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS)(
81   IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL                       *This,
82   IN  EFI_HANDLE                                            ControllerHandle,
83   IN  EFI_HANDLE                                            ChildHandle  OPTIONAL,
84   IN  EFI_DRIVER_DIAGNOSTIC_TYPE                            DiagnosticType,
85   IN  CHAR8                                                 *Language,
86   OUT EFI_GUID                                              **ErrorType,
87   OUT UINTN                                                 *BufferSize,
88   OUT CHAR16                                                **Buffer
89   );
90 
91 ///
92 /// Used to perform diagnostics on a controller that an EFI Driver is managing.
93 ///
94 struct _EFI_DRIVER_DIAGNOSTICS2_PROTOCOL {
95   EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS    RunDiagnostics;
96   ///
97   /// A Null-terminated ASCII string that contains one or more RFC 4646
98   /// language codes.  This is the list of language codes that this protocol supports.
99   ///
100   CHAR8                                      *SupportedLanguages;
101 };
102 
103 extern EFI_GUID  gEfiDriverDiagnostics2ProtocolGuid;
104 
105 #endif
106