2 BIOS system slot designator information boot time changes.
5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "MiscSubclassDriver.h"
12 This function makes boot time changes to the contents of the
13 MiscSystemSlotDesignator structure (Type 9).
15 @param RecordData Pointer to copy of RecordData from the Data Table.
17 @retval EFI_SUCCESS All parameters were valid.
18 @retval EFI_UNSUPPORTED Unexpected RecordType value.
19 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
22 MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation
)
24 CHAR8
*OptionalStrStart
;
25 UINTN SlotDesignationStrLen
;
27 EFI_STRING SlotDesignation
;
28 STRING_REF TokenToGet
;
29 SMBIOS_TABLE_TYPE9
*SmbiosRecord
;
30 EFI_SMBIOS_HANDLE SmbiosHandle
;
31 EFI_MISC_SYSTEM_SLOT_DESIGNATION
* ForType9InputData
;
33 ForType9InputData
= (EFI_MISC_SYSTEM_SLOT_DESIGNATION
*)RecordData
;
36 // First check for invalid parameters.
38 if (RecordData
== NULL
) {
39 return EFI_INVALID_PARAMETER
;
43 switch (ForType9InputData
->SlotDesignation
) {
44 case STR_MISC_SYSTEM_SLOT_DESIGNATION
:
45 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION
);
51 SlotDesignation
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
52 SlotDesignationStrLen
= StrLen(SlotDesignation
);
53 if (SlotDesignationStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
54 return EFI_UNSUPPORTED
;
58 // Two zeros following the last string.
60 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE9
) + SlotDesignationStrLen
+ 1 + 1);
61 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE9
) +SlotDesignationStrLen
+ 1 + 1);
63 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_SLOTS
;
64 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE9
);
65 SmbiosRecord
->Hdr
.Handle
= 0;
66 SmbiosRecord
->SlotDesignation
= 1;
67 SmbiosRecord
->SlotType
= (UINT8
)ForType9InputData
->SlotType
;
68 SmbiosRecord
->SlotDataBusWidth
= (UINT8
)ForType9InputData
->SlotDataBusWidth
;
69 SmbiosRecord
->CurrentUsage
= (UINT8
)ForType9InputData
->SlotUsage
;
70 SmbiosRecord
->SlotLength
= (UINT8
)ForType9InputData
->SlotLength
;
71 SmbiosRecord
->SlotID
= ForType9InputData
->SlotId
;
74 // Slot Characteristics
76 CopyMem ((UINT8
*) &SmbiosRecord
->SlotCharacteristics1
,(UINT8
*) &ForType9InputData
->SlotCharacteristics
,2);
77 OptionalStrStart
= (CHAR8
*)(SmbiosRecord
+ 1);
78 UnicodeStrToAsciiStr(SlotDesignation
, OptionalStrStart
);
80 // Now we have got the full smbios record, call smbios protocol to add this record.
82 Status
= AddSmbiosRecord (Smbios
, &SmbiosHandle
, (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
);
84 FreePool(SmbiosRecord
);