1 /** @file 2 BIOS system slot designator information boot time changes. 3 SMBIOS type 9. 4 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 10 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. 13 14 **/ 15 16 #include "MiscSubClassDriver.h" 17 /** 18 This function makes boot time changes to the contents of the 19 MiscSystemSlotDesignator structure (Type 9). 20 21 @param RecordData Pointer to copy of RecordData from the Data Table. 22 23 @retval EFI_SUCCESS All parameters were valid. 24 @retval EFI_UNSUPPORTED Unexpected RecordType value. 25 @retval EFI_INVALID_PARAMETER Invalid parameter was found. 26 27 **/ 28 MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation) 29 { 30 CHAR8 *OptionalStrStart; 31 UINTN SlotDesignationStrLen; 32 EFI_STATUS Status; 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; 38 39 ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData; 40 41 // 42 // First check for invalid parameters. 43 // 44 if (RecordData == NULL) { 45 return EFI_INVALID_PARAMETER; 46 } 47 48 TokenToGet = 0; 49 switch (ForType9InputData->SlotDesignation) { 50 case STR_MISC_SYSTEM_SLOT_DESIGNATION: 51 TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION); 52 break; 53 default: 54 break; 55 } 56 57 SlotDesignation = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL); 58 SlotDesignationStrLen = StrLen(SlotDesignation); 59 if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) { 60 return EFI_UNSUPPORTED; 61 } 62 63 // 64 // Two zeros following the last string. 65 // 66 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1); 67 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1); 68 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 = ForType9InputData->SlotType; 74 SmbiosRecord->SlotDataBusWidth = ForType9InputData->SlotDataBusWidth; 75 SmbiosRecord->CurrentUsage = ForType9InputData->SlotUsage; 76 SmbiosRecord->SlotLength = ForType9InputData->SlotLength; 77 SmbiosRecord->SlotID = ForType9InputData->SlotId; 78 79 // 80 // Slot Characteristics 81 // 82 CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2); 83 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); 84 UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart); 85 // 86 // Now we have got the full smbios record, call smbios protocol to add this record. 87 // 88 Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); 89 90 FreePool(SmbiosRecord); 91 return Status; 92 } 93