-/*++\r
+/**@file\r
\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
\r
Abstract:\r
\r
---*/\r
+**/\r
#include <Uefi.h>\r
#include <WinNtDxe.h>\r
#include <Protocol/BlockIo.h>\r
//\r
// EFI Driver Diagnostics Protocol\r
//\r
-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {\r
WinNtBlockIoDriverDiagnosticsRunDiagnostics,\r
- LANGUAGESUPPORTED\r
+ "eng"\r
+};\r
+\r
+//\r
+// EFI Driver Diagnostics 2 Protocol\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gWinNtBlockIoDriverDiagnostics2 = {\r
+ (EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) WinNtBlockIoDriverDiagnosticsRunDiagnostics,\r
+ "en"\r
};\r
\r
EFI_STATUS\r
specified by ControllerHandle and ChildHandle. See\r
"Related Definitions" for the list of supported types.\r
Language - A pointer to a three character ISO 639-2 language\r
- identifier. This is the language in which the optional\r
+ identifier or a Null-terminated ASCII string array indicating\r
+ the language. This is the language in which the optional\r
error message should be returned in Buffer, and it must\r
match one of the languages specified in SupportedLanguages.\r
The number of languages supported by a driver is up to\r
{\r
EFI_STATUS Status;\r
EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
- CHAR8 *SupportedLanguage;\r
+ CHAR8 *SupportedLanguages;\r
+ BOOLEAN Iso639Language;\r
+ BOOLEAN Found;\r
+ UINTN Index;\r
\r
if (Language == NULL ||\r
ErrorType == NULL ||\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- SupportedLanguage = This->SupportedLanguages;\r
-\r
- Status = EFI_UNSUPPORTED;\r
- while (*SupportedLanguage != 0) {\r
- if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {\r
- Status = EFI_SUCCESS;\r
- break;\r
+ SupportedLanguages = This->SupportedLanguages;\r
+ Iso639Language = (BOOLEAN)(This == &gWinNtBlockIoDriverDiagnostics);\r
+ //\r
+ // Make sure Language is in the set of Supported Languages\r
+ //\r
+ Found = FALSE;\r
+ while (*SupportedLanguages != 0) {\r
+ if (Iso639Language) {\r
+ if (CompareMem (Language, SupportedLanguages, 3) == 0) {\r
+ Found = TRUE;\r
+ break;\r
+ }\r
+ SupportedLanguages += 3;\r
+ } else {\r
+ for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);\r
+ if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {\r
+ Found = TRUE;\r
+ break;\r
+ }\r
+ SupportedLanguages += Index;\r
+ for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);\r
}\r
-\r
- SupportedLanguage += 3;\r
}\r
-\r
- if (EFI_ERROR (Status)) {\r
+ //\r
+ // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED\r
+ //\r
+ if (!Found) {\r
return EFI_UNSUPPORTED;\r
}\r
-\r
+ \r
*ErrorType = NULL;\r
*BufferSize = 0;\r
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {\r
*ErrorType = &gEfiBlockIoProtocolGuid;\r
*BufferSize = 0x60;\r
- Buffer = AllocatePool ((UINTN) (*BufferSize));\r
+ *Buffer = AllocatePool ((UINTN) (*BufferSize));\r
CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ //\r
+ // This is a device driver, so ChildHandle must be NULL.\r
+ //\r
+ if (ChildHandle != NULL) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
//\r
// Validate controller handle\r
//\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
&gEfiWinNtIoProtocolGuid,\r
- &BlockIo,\r
+ (VOID **) &BlockIo,\r
gWinNtBlockIoDriverBinding.DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ \r
if (Status == EFI_UNSUPPORTED) {\r
return Status;\r
} else if (Status != EFI_ALREADY_STARTED) {\r