2 BIOS system slot designator information boot time changes.
5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "MiscSubclassDriver.h"
18 This function makes boot time changes to the contents of the
19 MiscSystemSlotDesignator structure (Type 9).
21 @param RecordData Pointer to copy of RecordData from the Data Table.
23 @retval EFI_SUCCESS All parameters were valid.
24 @retval EFI_UNSUPPORTED Unexpected RecordType value.
25 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
28 MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation
)
30 CHAR8
*OptionalStrStart
;
31 UINTN SlotDesignationStrLen
;
33 EFI_STRING SlotDesignation
;
34 STRING_REF TokenToGet
;
35 SMBIOS_TABLE_TYPE9
*SmbiosRecord
;
36 EFI_SMBIOS_HANDLE SmbiosHandle
;
37 EFI_MISC_SYSTEM_SLOT_DESIGNATION
* ForType9InputData
;
39 ForType9InputData
= (EFI_MISC_SYSTEM_SLOT_DESIGNATION
*)RecordData
;
42 // First check for invalid parameters.
44 if (RecordData
== NULL
) {
45 return EFI_INVALID_PARAMETER
;
49 switch (ForType9InputData
->SlotDesignation
) {
50 case STR_MISC_SYSTEM_SLOT_DESIGNATION
:
51 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION
);
57 SlotDesignation
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
58 SlotDesignationStrLen
= StrLen(SlotDesignation
);
59 if (SlotDesignationStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
60 return EFI_UNSUPPORTED
;
64 // Two zeros following the last string.
66 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE9
) + SlotDesignationStrLen
+ 1 + 1);
67 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE9
) +SlotDesignationStrLen
+ 1 + 1);
69 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_SLOTS
;
70 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE9
);
71 SmbiosRecord
->Hdr
.Handle
= 0;
72 SmbiosRecord
->SlotDesignation
= 1;
73 SmbiosRecord
->SlotType
= (UINT8
)ForType9InputData
->SlotType
;
74 SmbiosRecord
->SlotDataBusWidth
= (UINT8
)ForType9InputData
->SlotDataBusWidth
;
75 SmbiosRecord
->CurrentUsage
= (UINT8
)ForType9InputData
->SlotUsage
;
76 SmbiosRecord
->SlotLength
= (UINT8
)ForType9InputData
->SlotLength
;
77 SmbiosRecord
->SlotID
= ForType9InputData
->SlotId
;
80 // Slot Characteristics
82 CopyMem ((UINT8
*) &SmbiosRecord
->SlotCharacteristics1
,(UINT8
*) &ForType9InputData
->SlotCharacteristics
,2);
83 OptionalStrStart
= (CHAR8
*)(SmbiosRecord
+ 1);
84 UnicodeStrToAsciiStr(SlotDesignation
, OptionalStrStart
);
86 // Now we have got the full smbios record, call smbios protocol to add this record.
88 Status
= AddSmbiosRecord (Smbios
, &SmbiosHandle
, (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
);
90 FreePool(SmbiosRecord
);