summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-30 05:28:45 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-30 05:28:45 +0000
commitdb168de9b09ab36330fb74af590cc80ef6a9e85a (patch)
tree54a8bc4fe1e766060b6d067e680c3a33a99c237f
parent6ee5bbddea3cf413ebfd76867c24446edad194b7 (diff)
downloadedk2-platforms-db168de9b09ab36330fb74af590cc80ef6a9e85a.tar.xz
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
-rw-r--r--Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c58
-rw-r--r--Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c2
-rw-r--r--Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h1
3 files changed, 44 insertions, 17 deletions
diff --git a/Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c b/Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c
index b20bdb56c9..1bfa3059b5 100644
--- a/Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c
+++ b/Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c
@@ -43,9 +43,17 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
//
// EFI Driver Diagnostics Protocol
//
-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {
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
@@ -78,7 +86,8 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
specified by ControllerHandle and ChildHandle. See
"Related Definitions" for the list of supported types.
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
match one of the languages specified in SupportedLanguages.
The number of languages supported by a driver is up to
@@ -121,7 +130,10 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
+ CHAR8 *SupportedLanguages;
+ BOOLEAN Iso639Language;
+ BOOLEAN Found;
+ UINTN Index;
if (Language == NULL ||
ErrorType == NULL ||
@@ -132,22 +144,36 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
return EFI_INVALID_PARAMETER;
}
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {
- Status = EFI_SUCCESS;
- break;
+ SupportedLanguages = This->SupportedLanguages;
+ Iso639Language = (BOOLEAN)(This == &gWinNtBlockIoDriverDiagnostics);
+ //
+ // Make sure Language is in the set of Supported Languages
+ //
+ Found = FALSE;
+ 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;
}
-
+
*ErrorType = NULL;
*BufferSize = 0;
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
diff --git a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
index 998fc5047d..1089d05111 100644
--- a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
+++ b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
@@ -119,7 +119,7 @@ InitializeWinNtBlockIo(
&gWinNtBlockIoComponentName2,
NULL,
&gWinNtBlockIoDriverDiagnostics,
- NULL
+ &gWinNtBlockIoDriverDiagnostics2
);
ASSERT_EFI_ERROR (Status);
diff --git a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h
index 313e25448c..6330daabf7 100644
--- a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h
+++ b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h
@@ -99,6 +99,7 @@ extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtBlockIoComponentName2;
extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration;
extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics;
+extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gWinNtBlockIoDriverDiagnostics2;
//
// EFI Driver Binding Functions