1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh EFI Driver Diagnostics Protocol 3*f439973dSWarner Losh 4*f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 5*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 6*f439973dSWarner Losh 7*f439973dSWarner Losh **/ 8*f439973dSWarner Losh 9*f439973dSWarner Losh #ifndef __EFI_DRIVER_DIAGNOSTICS_H__ 10*f439973dSWarner Losh #define __EFI_DRIVER_DIAGNOSTICS_H__ 11*f439973dSWarner Losh 12*f439973dSWarner Losh /// 13*f439973dSWarner Losh /// The global ID for the Driver Diagnostics Protocol as defined in EFI 1.1. 14*f439973dSWarner Losh /// 15*f439973dSWarner Losh #define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \ 16*f439973dSWarner Losh { \ 17*f439973dSWarner Losh 0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ 18*f439973dSWarner Losh } 19*f439973dSWarner Losh 20*f439973dSWarner Losh typedef struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL EFI_DRIVER_DIAGNOSTICS_PROTOCOL; 21*f439973dSWarner Losh 22*f439973dSWarner Losh typedef enum { 23*f439973dSWarner Losh /// 24*f439973dSWarner Losh /// Performs standard diagnostics on the controller. 25*f439973dSWarner Losh /// 26*f439973dSWarner Losh EfiDriverDiagnosticTypeStandard = 0, 27*f439973dSWarner Losh /// 28*f439973dSWarner Losh /// This is an optional diagnostic type that performs diagnostics on the controller that may 29*f439973dSWarner Losh /// take an extended amount of time to execute. 30*f439973dSWarner Losh /// 31*f439973dSWarner Losh EfiDriverDiagnosticTypeExtended = 1, 32*f439973dSWarner Losh /// 33*f439973dSWarner Losh /// This is an optional diagnostic type that performs diagnostics on the controller that are 34*f439973dSWarner Losh /// suitable for a manufacturing and test environment. 35*f439973dSWarner Losh /// 36*f439973dSWarner Losh EfiDriverDiagnosticTypeManufacturing = 2, 37*f439973dSWarner Losh /// 38*f439973dSWarner Losh /// This is an optional diagnostic type that would only be used in the situation where an 39*f439973dSWarner Losh /// EFI_NOT_READY had been returned by a previous call to RunDiagnostics() 40*f439973dSWarner Losh /// and there is a desire to cancel the current running diagnostics operation. 41*f439973dSWarner Losh /// 42*f439973dSWarner Losh EfiDriverDiagnosticTypeCancel = 3, 43*f439973dSWarner Losh EfiDriverDiagnosticTypeMaximum 44*f439973dSWarner Losh } EFI_DRIVER_DIAGNOSTIC_TYPE; 45*f439973dSWarner Losh 46*f439973dSWarner Losh /** 47*f439973dSWarner Losh Runs diagnostics on a controller. 48*f439973dSWarner Losh 49*f439973dSWarner Losh @param This A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance. 50*f439973dSWarner Losh @param ControllerHandle The handle of the controller to run diagnostics on. 51*f439973dSWarner Losh @param ChildHandle The handle of the child controller to run diagnostics on 52*f439973dSWarner Losh This is an optional parameter that may be NULL. It will 53*f439973dSWarner Losh be NULL for device drivers. It will also be NULL for a 54*f439973dSWarner Losh bus drivers that wish to run diagnostics on the bus 55*f439973dSWarner Losh controller. It will not be NULL for a bus driver that 56*f439973dSWarner Losh wishes to run diagnostics on one of its child controllers. 57*f439973dSWarner Losh @param DiagnosticType Indicates type of diagnostics to perform on the controller 58*f439973dSWarner Losh specified by ControllerHandle and ChildHandle. See 59*f439973dSWarner Losh "Related Definitions" for the list of supported types. 60*f439973dSWarner Losh @param Language A pointer to a three character ISO 639-2 language 61*f439973dSWarner Losh identifier. This is the language in which the optional 62*f439973dSWarner Losh error message should be returned in Buffer, and it must 63*f439973dSWarner Losh match one of the languages specified in SupportedLanguages. 64*f439973dSWarner Losh The number of languages supported by a driver is up to 65*f439973dSWarner Losh the driver writer. 66*f439973dSWarner Losh @param ErrorType A GUID that defines the format of the data returned in Buffer. 67*f439973dSWarner Losh @param BufferSize The size, in bytes, of the data returned in Buffer. 68*f439973dSWarner Losh @param Buffer A buffer that contains a Null-terminated string 69*f439973dSWarner Losh plus some additional data whose format is defined by 70*f439973dSWarner Losh ErrorType. Buffer is allocated by this function with 71*f439973dSWarner Losh AllocatePool(), and it is the caller's responsibility 72*f439973dSWarner Losh to free it with a call to FreePool(). 73*f439973dSWarner Losh 74*f439973dSWarner Losh @retval EFI_SUCCESS The controller specified by ControllerHandle and 75*f439973dSWarner Losh ChildHandle passed the diagnostic. 76*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. 77*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it is not a valid EFI_HANDLE. 78*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER Language is NULL. 79*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER ErrorType is NULL. 80*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER BufferType is NULL. 81*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER Buffer is NULL. 82*f439973dSWarner Losh @retval EFI_UNSUPPORTED The driver specified by This does not support 83*f439973dSWarner Losh running diagnostics for the controller specified 84*f439973dSWarner Losh by ControllerHandle and ChildHandle. 85*f439973dSWarner Losh @retval EFI_UNSUPPORTED The driver specified by This does not support the 86*f439973dSWarner Losh type of diagnostic specified by DiagnosticType. 87*f439973dSWarner Losh @retval EFI_UNSUPPORTED The driver specified by This does not support the 88*f439973dSWarner Losh language specified by Language. 89*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES There are not enough resources available to complete 90*f439973dSWarner Losh the diagnostics. 91*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES There are not enough resources available to return 92*f439973dSWarner Losh the status information in ErrorType, BufferSize, 93*f439973dSWarner Losh and Buffer. 94*f439973dSWarner Losh @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and 95*f439973dSWarner Losh ChildHandle did not pass the diagnostic. 96*f439973dSWarner Losh 97*f439973dSWarner Losh **/ 98*f439973dSWarner Losh typedef 99*f439973dSWarner Losh EFI_STATUS 100*f439973dSWarner Losh (EFIAPI *EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS)( 101*f439973dSWarner Losh IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This, 102*f439973dSWarner Losh IN EFI_HANDLE ControllerHandle, 103*f439973dSWarner Losh IN EFI_HANDLE ChildHandle OPTIONAL, 104*f439973dSWarner Losh IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType, 105*f439973dSWarner Losh IN CHAR8 *Language, 106*f439973dSWarner Losh OUT EFI_GUID **ErrorType, 107*f439973dSWarner Losh OUT UINTN *BufferSize, 108*f439973dSWarner Losh OUT CHAR16 **Buffer 109*f439973dSWarner Losh ); 110*f439973dSWarner Losh 111*f439973dSWarner Losh /// 112*f439973dSWarner Losh /// Used to perform diagnostics on a controller that an EFI Driver is managing. 113*f439973dSWarner Losh /// 114*f439973dSWarner Losh struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL { 115*f439973dSWarner Losh EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS RunDiagnostics; 116*f439973dSWarner Losh /// 117*f439973dSWarner Losh /// A Null-terminated ASCII string that contains one or more ISO 639-2 118*f439973dSWarner Losh /// language codes. This is the list of language codes that this protocol supports. 119*f439973dSWarner Losh /// 120*f439973dSWarner Losh CHAR8 *SupportedLanguages; 121*f439973dSWarner Losh }; 122*f439973dSWarner Losh 123*f439973dSWarner Losh extern EFI_GUID gEfiDriverDiagnosticsProtocolGuid; 124*f439973dSWarner Losh 125*f439973dSWarner Losh #endif 126