]>
Commit | Line | Data |
---|---|---|
5d73d92f | 1 | /** @file\r |
2 | Lib fucntions for SMBIOS. Used to get system serial number and GUID\r | |
3 | \r | |
4 | Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "../UefiShellDebug1CommandsLib.h"\r | |
16 | #include <Guid/Smbios.h>\r | |
17 | #include "LibSmbios.h"\r | |
18 | \r | |
a1d4bfcc | 19 | /**\r |
20 | Return SMBIOS string given the string number.\r | |
5d73d92f | 21 | \r |
a1d4bfcc | 22 | @param[in] Smbios Pointer to SMBIOS structure.\r |
23 | @param[in] StringNumber String number to return. -1 is used to skip all strings and\r | |
24 | point to the next SMBIOS structure.\r | |
5d73d92f | 25 | \r |
a1d4bfcc | 26 | @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1\r |
27 | **/\r | |
28 | CHAR8*\r | |
5d73d92f | 29 | LibGetSmbiosString (\r |
30 | IN SMBIOS_STRUCTURE_POINTER *Smbios,\r | |
31 | IN UINT16 StringNumber\r | |
32 | )\r | |
5d73d92f | 33 | {\r |
34 | UINT16 Index;\r | |
35 | CHAR8 *String;\r | |
36 | \r | |
37 | ASSERT (Smbios != NULL);\r | |
38 | \r | |
39 | //\r | |
40 | // Skip over formatted section\r | |
41 | //\r | |
42 | String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);\r | |
43 | \r | |
44 | //\r | |
45 | // Look through unformated section\r | |
46 | //\r | |
47 | for (Index = 1; Index <= StringNumber; Index++) {\r | |
48 | if (StringNumber == Index) {\r | |
49 | return String;\r | |
50 | }\r | |
51 | //\r | |
52 | // Skip string\r | |
53 | //\r | |
54 | for (; *String != 0; String++);\r | |
55 | String++;\r | |
56 | \r | |
57 | if (*String == 0) {\r | |
58 | //\r | |
59 | // If double NULL then we are done.\r | |
60 | // Retrun pointer to next structure in Smbios.\r | |
61 | // if you pass in a -1 you will always get here\r | |
62 | //\r | |
63 | Smbios->Raw = (UINT8 *)++String;\r | |
64 | return NULL;\r | |
65 | }\r | |
66 | }\r | |
67 | \r | |
68 | return NULL;\r | |
69 | }\r |