3 Copyright (c) 2009, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
15 MiscSystemSlotDesignatorFunction.c
19 BIOS system slot designator information boot time changes.
24 #include "MiscSubclassDriver.h"
26 This function makes boot time changes to the contents of the
27 MiscSystemSlotDesignator structure (Type 9).
29 @param RecordData Pointer to copy of RecordData from the Data Table.
31 @retval EFI_SUCCESS All parameters were valid.
32 @retval EFI_UNSUPPORTED Unexpected RecordType value.
33 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
36 MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation
)
38 CHAR8
*OptionalStrStart
;
39 UINTN SlotDesignationStrLen
;
41 EFI_STRING SlotDesignation
;
42 STRING_REF TokenToGet
;
43 SMBIOS_TABLE_TYPE9
*SmbiosRecord
;
44 EFI_SMBIOS_HANDLE SmbiosHandle
;
45 EFI_MISC_SYSTEM_SLOT_DESIGNATION
* ForType9InputData
;
47 ForType9InputData
= (EFI_MISC_SYSTEM_SLOT_DESIGNATION
*)RecordData
;
50 // First check for invalid parameters.
52 if (RecordData
== NULL
) {
53 return EFI_INVALID_PARAMETER
;
57 switch (ForType9InputData
->SlotDesignation
) {
58 case STR_MISC_SYSTEM_SLOT_DESIGNATION
:
59 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION
);
65 SlotDesignation
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
66 SlotDesignationStrLen
= StrLen(SlotDesignation
);
67 if (SlotDesignationStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
68 return EFI_UNSUPPORTED
;
72 // Two zeros following the last string.
74 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE9
) + SlotDesignationStrLen
+ 1 + 1);
75 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE9
) +SlotDesignationStrLen
+ 1 + 1);
77 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_SLOTS
;
78 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE9
);
79 SmbiosRecord
->Hdr
.Handle
= 0;
80 SmbiosRecord
->SlotDesignation
= 1;
81 SmbiosRecord
->SlotType
= ForType9InputData
->SlotType
;
82 SmbiosRecord
->SlotDataBusWidth
= ForType9InputData
->SlotDataBusWidth
;
83 SmbiosRecord
->CurrentUsage
= ForType9InputData
->SlotUsage
;
84 SmbiosRecord
->SlotLength
= ForType9InputData
->SlotLength
;
85 SmbiosRecord
->SlotID
= ForType9InputData
->SlotId
;
88 // Slot Characteristics
90 CopyMem ((UINT8
*) &SmbiosRecord
->SlotCharacteristics1
,(UINT8
*) &ForType9InputData
->SlotCharacteristics
,2);
91 OptionalStrStart
= (CHAR8
*)(SmbiosRecord
+ 1);
92 UnicodeStrToAsciiStr(SlotDesignation
, OptionalStrStart
);
94 // Now we have got the full smbios record, call smbios protocol to add this record.
97 Status
= Smbios
-> Add(
101 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
103 FreePool(SmbiosRecord
);