]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationFunction.c
Vlv2TbltDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / Vlv2TbltDevicePkg / SmBiosMiscDxe / MiscBootInformationFunction.c
1 /*++
2
3 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7
8
9
10 Module Name:
11
12 MiscBootInformationFunction.c
13
14 Abstract:
15
16 boot information boot time changes.
17 SMBIOS type 32.
18
19 --*/
20
21
22 #include "CommonHeader.h"
23
24 #include "MiscSubclassDriver.h"
25
26
27 /**
28 This function makes boot time changes to the contents of the
29 MiscBootInformation (Type 32).
30
31 @param RecordData Pointer to copy of RecordData from the Data Table.
32
33 @retval EFI_SUCCESS All parameters were valid.
34 @retval EFI_UNSUPPORTED Unexpected RecordType value.
35 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
36
37 **/
38
39 MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)
40 {
41 EFI_STATUS Status;
42 EFI_SMBIOS_HANDLE SmbiosHandle;
43 SMBIOS_TABLE_TYPE32 *SmbiosRecord;
44 EFI_MISC_BOOT_INFORMATION_STATUS* ForType32InputData;
45
46 ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData;
47
48 //
49 // First check for invalid parameters.
50 //
51 if (RecordData == NULL) {
52 return EFI_INVALID_PARAMETER;
53 }
54
55 //
56 // Two zeros following the last string.
57 //
58 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
59 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
60
61 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
62 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
63
64 //
65 // Make handle chosen by smbios protocol.add automatically.
66 //
67 SmbiosRecord->Hdr.Handle = 0;
68 SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus;
69
70 //
71 // Now we have got the full smbios record, call smbios protocol to add this record.
72 //
73 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
74 Status = Smbios-> Add(
75 Smbios,
76 NULL,
77 &SmbiosHandle,
78 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
79 );
80 FreePool(SmbiosRecord);
81 return Status;
82 }