]>
Commit | Line | Data |
---|---|---|
5e973c96 | 1 | /** @file\r |
1fdd39d3 | 2 | BIOS system slot designator information boot time changes.\r |
3 | SMBIOS type 9.\r | |
5e973c96 | 4 | \r |
7ee85aa2 | 5 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r |
9d2eedba | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
5e973c96 | 7 | \r |
8 | **/\r | |
1fdd39d3 | 9 | \r |
10 | #include "MiscSubclassDriver.h"\r | |
11 | /**\r | |
12 | This function makes boot time changes to the contents of the\r | |
13 | MiscSystemSlotDesignator structure (Type 9).\r | |
14 | \r | |
15 | @param RecordData Pointer to copy of RecordData from the Data Table. \r | |
16 | \r | |
17 | @retval EFI_SUCCESS All parameters were valid.\r | |
18 | @retval EFI_UNSUPPORTED Unexpected RecordType value.\r | |
19 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
20 | \r | |
21 | **/\r | |
22 | MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation)\r | |
23 | {\r | |
24 | CHAR8 *OptionalStrStart;\r | |
25 | UINTN SlotDesignationStrLen;\r | |
26 | EFI_STATUS Status;\r | |
27 | EFI_STRING SlotDesignation;\r | |
28 | STRING_REF TokenToGet;\r | |
29 | SMBIOS_TABLE_TYPE9 *SmbiosRecord;\r | |
30 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
31 | EFI_MISC_SYSTEM_SLOT_DESIGNATION* ForType9InputData;\r | |
32 | \r | |
33 | ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData;\r | |
34 | \r | |
35 | //\r | |
36 | // First check for invalid parameters.\r | |
37 | //\r | |
38 | if (RecordData == NULL) {\r | |
39 | return EFI_INVALID_PARAMETER;\r | |
40 | }\r | |
41 | \r | |
42 | TokenToGet = 0;\r | |
43 | switch (ForType9InputData->SlotDesignation) {\r | |
44 | case STR_MISC_SYSTEM_SLOT_DESIGNATION: \r | |
45 | TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION);\r | |
46 | break;\r | |
47 | default:\r | |
48 | break;\r | |
49 | }\r | |
50 | \r | |
51 | SlotDesignation = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r | |
52 | SlotDesignationStrLen = StrLen(SlotDesignation);\r | |
53 | if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) {\r | |
54 | return EFI_UNSUPPORTED;\r | |
55 | }\r | |
56 | \r | |
57 | //\r | |
58 | // Two zeros following the last string.\r | |
59 | //\r | |
60 | SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1);\r | |
61 | ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1);\r | |
62 | \r | |
63 | SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;\r | |
64 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE9);\r | |
65 | SmbiosRecord->Hdr.Handle = 0; \r | |
66 | SmbiosRecord->SlotDesignation = 1;\r | |
5b368e7d | 67 | SmbiosRecord->SlotType = (UINT8)ForType9InputData->SlotType;\r |
68 | SmbiosRecord->SlotDataBusWidth = (UINT8)ForType9InputData->SlotDataBusWidth;\r | |
69 | SmbiosRecord->CurrentUsage = (UINT8)ForType9InputData->SlotUsage;\r | |
70 | SmbiosRecord->SlotLength = (UINT8)ForType9InputData->SlotLength;\r | |
1fdd39d3 | 71 | SmbiosRecord->SlotID = ForType9InputData->SlotId;\r |
72 | \r | |
73 | //\r | |
74 | // Slot Characteristics\r | |
75 | //\r | |
76 | CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2);\r | |
77 | OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r | |
78 | UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart);\r | |
79 | // \r | |
80 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
81 | //\r | |
7ee85aa2 SZ |
82 | Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);\r |
83 | \r | |
1fdd39d3 | 84 | FreePool(SmbiosRecord);\r |
85 | return Status;\r | |
86 | }\r |