1 /** @file
2   boot information boot time changes.
3   SMBIOS type 32.
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 
19 /**
20   This function makes boot time changes to the contents of the
21   MiscBootInformation (Type 32).
22 
23   @param  RecordData                 Pointer to copy of RecordData from the Data Table.
24 
25   @retval EFI_SUCCESS                All parameters were valid.
26   @retval EFI_UNSUPPORTED            Unexpected RecordType value.
27   @retval EFI_INVALID_PARAMETER      Invalid parameter was found.
28 
29 **/
30 
MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)31 MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)
32 {
33   EFI_STATUS                         Status;
34   EFI_SMBIOS_HANDLE                  SmbiosHandle;
35   SMBIOS_TABLE_TYPE32                *SmbiosRecord;
36   EFI_MISC_BOOT_INFORMATION_STATUS*  ForType32InputData;
37 
38   ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData;
39 
40   //
41   // First check for invalid parameters.
42   //
43   if (RecordData == NULL) {
44     return EFI_INVALID_PARAMETER;
45   }
46 
47   //
48   // Two zeros following the last string.
49   //
50   SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
51   ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
52 
53   SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
54   SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
55   //
56   // Make handle chosen by smbios protocol.add automatically.
57   //
58   SmbiosRecord->Hdr.Handle = 0;
59   SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus;
60 
61   //
62   // Now we have got the full smbios record, call smbios protocol to add this record.
63   //
64   Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
65 
66   FreePool(SmbiosRecord);
67   return Status;
68 }
69