1 /** @file
2 This driver parses the mSmbiosMiscDataTable structure and reports
3 any generated data using SMBIOS protocol.
4
5 Copyright (c) 2013-2015 Intel Corporation.
6
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15
16 **/
17
18
19 #include "CommonHeader.h"
20
21 #include "SmbiosMisc.h"
22
23
24 extern UINT8 SmbiosMiscStrings[];
25 EFI_HANDLE mImageHandle;
26
27 EFI_HII_HANDLE mHiiHandle;
28
29
30
31 /**
32 Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
33 structure and reports any generated data using SMBIOS protocol.
34
35 @param ImageHandle Handle for the image of this driver
36 @param SystemTable Pointer to the EFI System Table
37
38 @retval EFI_SUCCESS The data was successfully stored.
39
40 **/
41 EFI_STATUS
42 EFIAPI
SmbiosMiscEntryPoint(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)43 SmbiosMiscEntryPoint(
44 IN EFI_HANDLE ImageHandle,
45 IN EFI_SYSTEM_TABLE *SystemTable
46 )
47 {
48 UINTN Index;
49 EFI_STATUS EfiStatus;
50 EFI_SMBIOS_PROTOCOL *Smbios;
51
52
53 mImageHandle = ImageHandle;
54
55 EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
56
57 if (EFI_ERROR(EfiStatus)) {
58 DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
59 return EfiStatus;
60 }
61
62 mHiiHandle = HiiAddPackages (
63 &gEfiCallerIdGuid,
64 mImageHandle,
65 SmbiosMiscStrings,
66 NULL
67 );
68 ASSERT (mHiiHandle != NULL);
69
70 for (Index = 0; Index < mSmbiosMiscDataTableEntries; ++Index) {
71 //
72 // If the entry have a function pointer, just log the data.
73 //
74 if (mSmbiosMiscDataTable[Index].Function != NULL) {
75 EfiStatus = (*mSmbiosMiscDataTable[Index].Function)(
76 mSmbiosMiscDataTable[Index].RecordData,
77 Smbios
78 );
79
80 if (EFI_ERROR(EfiStatus)) {
81 DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
82 return EfiStatus;
83 }
84 }
85 }
86
87 return EfiStatus;
88 }
89