1 diff -urN --binary -a -x CVS Oldv1.5/Application/Shell/Library/EfiShellLib.h Newv1.5/Application/Shell/Library/EfiShellLib.h
2 --- Oldv1.5/Application/Shell/Library/EfiShellLib.h 2008-06-10 13:46:56.000000000 +0800
3 +++ Newv1.5/Application/Shell/Library/EfiShellLib.h 2008-07-09 11:45:28.026417300 +0800
6 // Environment variable name constants
8 -#define VarLanguageCodes L"LangCodes"
9 -#define VarLanguage L"Lang"
10 -#define VarTimeout L"Timeout"
11 -#define VarConsoleIn L"ConIn"
12 -#define VarConsoleOut L"ConOut"
13 -#define VarErrorOut L"ErrOut"
14 -#define VarBootOption L"Boot%04x"
15 -#define VarBootOrder L"BootOrder"
16 -#define VarBootNext L"BootNext"
17 -#define VarBootCurrent L"BootCurrent"
18 -#define VarDriverOption L"Driver%04x"
19 -#define VarDriverOrder L"DriverOrder"
20 -#define VarConsoleInpDev L"ConInDev"
21 -#define VarConsoleOutDev L"ConOutDev"
22 -#define VarErrorOutDev L"ErrOutDev"
23 -#define LanguageCodeEnglish "eng"
24 +#define VarLanguageCodes L"LangCodes"
25 +#define VarLanguage L"Lang"
26 +#define VarTimeout L"Timeout"
27 +#define VarConsoleIn L"ConIn"
28 +#define VarConsoleOut L"ConOut"
29 +#define VarErrorOut L"ErrOut"
30 +#define VarBootOption L"Boot%04x"
31 +#define VarBootOrder L"BootOrder"
32 +#define VarBootNext L"BootNext"
33 +#define VarBootCurrent L"BootCurrent"
34 +#define VarDriverOption L"Driver%04x"
35 +#define VarDriverOrder L"DriverOrder"
36 +#define VarConsoleInpDev L"ConInDev"
37 +#define VarConsoleOutDev L"ConOutDev"
38 +#define VarErrorOutDev L"ErrOutDev"
39 +#define LanguageCodeEnglish "eng"
40 +#define PlatformLanguageCodeEnglish "en-US"
42 #define ISO_639_2_ENTRY_SIZE 3
43 #define RFC_3066_ENTRY_SIZE 12
49 +ExtractSupportedLanguage (
50 + IN CONST CHAR8 *SupportedLanguages,
51 + IN CONST CHAR8 *Language
55 diff -urN --binary -a -x CVS Oldv1.5/Application/Shell/Library/Misc.c Newv1.5/Application/Shell/Library/Misc.c
56 --- Oldv1.5/Application/Shell/Library/Misc.c 2008-06-10 13:46:56.000000000 +0800
57 +++ Newv1.5/Application/Shell/Library/Misc.c 2008-07-09 11:45:28.088917700 +0800
58 @@ -2271,3 +2271,76 @@
64 +ExtractSupportedLanguage (
65 + IN CONST CHAR8 *SupportedLanguages,
66 + IN CONST CHAR8 *Language
70 + Routine Description:
72 + This function matches the major language code (first two characters) in the
73 + SupportedLanguages. The first language code in the SupportedLanguages that
74 + matches first two characters of the input Language is returned. If there is no
75 + such match, then NULL is returned.
79 + SupportedLanguages - A Null-terminated ASCII string that contains one
80 + or more supported language codes.
82 + LangCode - A pointer to a Null-terminated ASCII string
83 + array indicating the RFC 3066 language.
87 + The RFC3066 language code that matches the major language.
91 + CONST CHAR8 *CurrentLanguage;
92 + CHAR8 *SupportedLanguage;
95 + CurrentLanguage = SupportedLanguages;
97 + while (CurrentLanguage != '\0') {
99 + // Search till the end of current language.
102 + while (CurrentLanguage[LanguageLen] != ';' && CurrentLanguage[LanguageLen] != '\0') {
107 + // should use AsciiStrnCmp(CurrentLanguage, Language, 2) == 0
109 + if ((CurrentLanguage[0] == Language[0]) && (CurrentLanguage[1] == Language[1])) {
111 + // Match the major language code, then return a new copy of
112 + // NULL-terminated SupportedLanguage.
114 + SupportedLanguage = AllocatePool (LanguageLen + 1);
115 + CopyMem (SupportedLanguage, (VOID *) CurrentLanguage, LanguageLen);
117 + SupportedLanguage[LanguageLen] = '\0';
119 + return SupportedLanguage;
122 + // Make CurrentLangue point to the next candiate language code.
124 + CurrentLanguage += LanguageLen;
125 + if (*CurrentLanguage == ';') {
135 diff -urN --binary -a -x CVS Oldv1.5/Application/Shell/SmbiosView/PrintInfo.c Newv1.5/Application/Shell/SmbiosView/PrintInfo.c
136 --- Oldv1.5/Application/Shell/SmbiosView/PrintInfo.c 2007-11-26 14:01:00.000000000 +0800
137 +++ Newv1.5/Application/Shell/SmbiosView/PrintInfo.c 2008-07-09 12:36:07.646190700 +0800
138 @@ -1779,7 +1779,7 @@
140 // MaxSize is determined by follow formula
142 - MaxSize = 1 << Size;
143 + MaxSize = (UINTN) 1 << Size;
144 PrintToken (STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), HiiHandle, MaxSize);
146 if (Option >= SHOW_DETAIL) {
147 diff -urN --binary -a -x CVS Oldv1.5/Application/Shell/SmbiosView/Smbios.h Newv1.5/Application/Shell/SmbiosView/Smbios.h
148 --- Oldv1.5/Application/Shell/SmbiosView/Smbios.h 2006-03-07 16:20:46.000000000 +0800
149 +++ Newv1.5/Application/Shell/SmbiosView/Smbios.h 2008-07-09 10:29:41.548254500 +0800
152 extern EFI_HII_HANDLE HiiHandle;
154 -#define EFI_SMBIOS_TABLE_GUID \
156 - 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
159 -extern EFI_GUID gEfiSmbiosTableGuid;
162 diff -urN --binary -a -x CVS Oldv1.5/Application/Shell/drivers/drivers.c Newv1.5/Application/Shell/drivers/drivers.c
163 --- Oldv1.5/Application/Shell/drivers/drivers.c 2008-05-26 13:22:52.000000000 +0800
164 +++ Newv1.5/Application/Shell/drivers/drivers.c 2008-07-09 12:36:16.552668700 +0800
169 + CHAR8 *PlatformLanguage;
170 UINTN DriverImageHandleCount;
171 EFI_HANDLE *DriverImageHandleBuffer;
174 SHELL_VAR_CHECK_PACKAGE ChkPck;
177 + PlatformLanguage = NULL;
178 DriverImageHandleCount = 0;
179 DriverImageHandleBuffer = NULL;
185 - Language = LibGetVariableLang ();
186 + Language = LibGetVariable (L"Lang", &gEfiGlobalVariableGuid);
187 if (Language == NULL) {
188 Language = (CHAR8 *)AllocateZeroPool(strlena(LanguageCodeEnglish) + 1);
189 if (Language == NULL) {
191 strcpya(Language, LanguageCodeEnglish);
194 + PlatformLanguage = LibGetVariable (L"PlatformLang", &gEfiGlobalVariableGuid);
195 + if (PlatformLanguage == NULL) {
196 + PlatformLanguage = (CHAR8 *)AllocateZeroPool(strlena(PlatformLanguageCodeEnglish) + 1);
197 + if (PlatformLanguage == NULL) {
198 + return EFI_OUT_OF_RESOURCES;
200 + strcpya(PlatformLanguage, PlatformLanguageCodeEnglish);
203 Item = LibCheckVarGetFlag (&ChkPck, L"-l");
205 if (Language != NULL) {
207 EFI_OPEN_PROTOCOL_GET_PROTOCOL
210 - ComponentName = NULL;
211 - ComponentName2 = NULL;
212 - Status = LibGetComponentNameProtocol (
213 - DriverImageHandleBuffer[Index],
218 DiagnosticsStatus = BS->OpenProtocol (
219 DriverImageHandleBuffer[Index],
220 &gEfiDriverDiagnostics2ProtocolGuid,
221 @@ -418,37 +421,73 @@
223 PrintToken (STRING_TOKEN (STR_SHELLENV_PROTID_ONE_VAR_D), HiiHandle, NumberOfChildren);
226 - Status = EFI_SUCCESS;
228 DriverName = L"<UNKNOWN>";
229 - SupportedLanguage = NULL;
230 - if (ComponentName != NULL) {
231 - if (ComponentName->GetDriverName != NULL) {
232 - SupportedLanguage = LibConvertSupportedLanguage (ComponentName->SupportedLanguages, Language);
233 + Status = BS->OpenProtocol (
234 + DriverImageHandleBuffer[Index],
235 + &gEfiComponentName2ProtocolGuid,
236 + (VOID **) &ComponentName2,
239 + EFI_OPEN_PROTOCOL_GET_PROTOCOL
241 + if (!EFI_ERROR (Status)) {
243 + // Driver has Component Name 2 Protocol is available, we get the
244 + // driver name var RFC 3066 language code
246 + Status = ComponentName2->GetDriverName (
251 + if (EFI_ERROR (Status)) {
253 + // Current RFC3066 language code fails, we then extract the supported
254 + // language from Component Name 2 protocol interface.
256 + SupportedLanguage = ExtractSupportedLanguage(ComponentName2->SupportedLanguages, Language);
257 + if (SupportedLanguage != NULL) {
258 + Status = ComponentName2->GetDriverName (
263 + FreePool(SupportedLanguage);
267 + if (EFI_ERROR (Status)) {
269 + // In case Component Name 2 protocol is not available or some error occurs
270 + // when getting driver name from Component Name 2 protocol, we get driver
271 + // name from Component Name protocol.
273 + Status = BS->OpenProtocol (
274 + DriverImageHandleBuffer[Index],
275 + &gEfiComponentNameProtocolGuid,
276 + (VOID **) &ComponentName,
279 + EFI_OPEN_PROTOCOL_GET_PROTOCOL
281 + if (!EFI_ERROR (Status)) {
282 Status = ComponentName->GetDriverName (
289 - } else if (ComponentName2 != NULL) {
290 - if (ComponentName2->GetDriverName != NULL) {
291 - SupportedLanguage = LibConvertSupportedLanguage (ComponentName2->SupportedLanguages, Language);
292 - Status = ComponentName2->GetDriverName (
299 - if (SupportedLanguage != NULL) {
300 - FreePool (SupportedLanguage);
303 if (EFI_ERROR (Status)) {
305 + // Fails to get driver name from either Component Name 2 & Component Name
306 + // Protocol, we show "<UNKNOWN>" string as driver name.
308 DriverName = L"<UNKNOWN>";
312 for (StringIndex = 0; StringIndex < StrLen (DriverName) && StringIndex < 35; StringIndex++) {
313 FormattedDriverName[StringIndex] = DriverName[StringIndex];
319 + if (PlatformLanguage != NULL) {
320 + FreePool (PlatformLanguage);
323 ShellCloseHandleEnumerator ();
324 LibCheckVarFreeVarList (&ChkPck);
325 LibUnInitializeStrings ();