Add Driver Diagnostic 2 Protocol support for WinNtBlockIo driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4240 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-10-30 05:28:45 +00:00
parent 6ee5bbddea
commit db168de9b0
3 changed files with 44 additions and 17 deletions

View File

@ -43,9 +43,17 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
// //
// EFI Driver Diagnostics Protocol // EFI Driver Diagnostics Protocol
// //
EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = { GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {
WinNtBlockIoDriverDiagnosticsRunDiagnostics, WinNtBlockIoDriverDiagnosticsRunDiagnostics,
LANGUAGESUPPORTED "eng"
};
//
// EFI Driver Diagnostics 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gWinNtBlockIoDriverDiagnostics2 = {
(EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) WinNtBlockIoDriverDiagnosticsRunDiagnostics,
"en"
}; };
EFI_STATUS EFI_STATUS
@ -78,7 +86,8 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
specified by ControllerHandle and ChildHandle. See specified by ControllerHandle and ChildHandle. See
"Related Definitions" for the list of supported types. "Related Definitions" for the list of supported types.
Language - A pointer to a three character ISO 639-2 language Language - A pointer to a three character ISO 639-2 language
identifier. This is the language in which the optional identifier or a Null-terminated ASCII string array indicating
the language. This is the language in which the optional
error message should be returned in Buffer, and it must error message should be returned in Buffer, and it must
match one of the languages specified in SupportedLanguages. match one of the languages specified in SupportedLanguages.
The number of languages supported by a driver is up to The number of languages supported by a driver is up to
@ -121,7 +130,10 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo; EFI_BLOCK_IO_PROTOCOL *BlockIo;
CHAR8 *SupportedLanguage; CHAR8 *SupportedLanguages;
BOOLEAN Iso639Language;
BOOLEAN Found;
UINTN Index;
if (Language == NULL || if (Language == NULL ||
ErrorType == NULL || ErrorType == NULL ||
@ -132,22 +144,36 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
SupportedLanguage = This->SupportedLanguages; SupportedLanguages = This->SupportedLanguages;
Iso639Language = (BOOLEAN)(This == &gWinNtBlockIoDriverDiagnostics);
Status = EFI_UNSUPPORTED; //
while (*SupportedLanguage != 0) { // Make sure Language is in the set of Supported Languages
if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) { //
Status = EFI_SUCCESS; Found = FALSE;
break; while (*SupportedLanguages != 0) {
if (Iso639Language) {
if (CompareMem (Language, SupportedLanguages, 3) == 0) {
Found = TRUE;
break;
}
SupportedLanguages += 3;
} else {
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
Found = TRUE;
break;
}
SupportedLanguages += Index;
for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
} }
SupportedLanguage += 3;
} }
//
if (EFI_ERROR (Status)) { // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
//
if (!Found) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
*ErrorType = NULL; *ErrorType = NULL;
*BufferSize = 0; *BufferSize = 0;
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) { if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {

View File

@ -119,7 +119,7 @@ InitializeWinNtBlockIo(
&gWinNtBlockIoComponentName2, &gWinNtBlockIoComponentName2,
NULL, NULL,
&gWinNtBlockIoDriverDiagnostics, &gWinNtBlockIoDriverDiagnostics,
NULL &gWinNtBlockIoDriverDiagnostics2
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -99,6 +99,7 @@ extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtBlockIoComponentName2; extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtBlockIoComponentName2;
extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration; extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration;
extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics; extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics;
extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gWinNtBlockIoDriverDiagnostics2;
// //
// EFI Driver Binding Functions // EFI Driver Binding Functions