]> git.proxmox.com Git - mirror_edk2.git/blob - EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOnboardDeviceFunction.c
• BaseMemoryLib:
[mirror_edk2.git] / EdkNt32Pkg / Dxe / Nt32Platform / MiscSubclass / MiscOnboardDeviceFunction.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 MiscOnboardDeviceFunction.c
15
16 Abstract:
17
18 Onboard device information boot time changes.
19 Misc. subclass type 8.
20 SMBIOS type 10.
21
22 --*/
23
24 #include "MiscSubclassDriver.h"
25 #include "winntio/winntio.h"
26 #include "winntthunk/winntthunk.h"
27
28 #pragma pack(1)
29
30 typedef struct _VENDOR_DEVICE {
31 EFI_DEVICE_PATH_PROTOCOL Platform;
32 EFI_GUID PlatformGuid;
33 EFI_DEVICE_PATH_PROTOCOL Device;
34 EFI_GUID DeviceGuid;
35 UINT8 DeviceData[4];
36 EFI_DEVICE_PATH_PROTOCOL End;
37
38 } VENDOR_DEVICE;
39 #pragma pack()
40
41 MISC_SUBCLASS_TABLE_FUNCTION (
42 MiscOnboardDeviceVideo
43 )
44 /*++
45 Description:
46
47 This function makes boot time changes to the contents of the
48 MiscOnboardDevice structure.
49
50 Parameters:
51
52 RecordType
53 Type of record to be processed from the Data Table.
54 mMiscSubclassDataTable[].RecordType
55
56 RecordLen
57 Size of static RecordData from the Data Table.
58 mMiscSubclassDataTable[].RecordLen
59
60 RecordData
61 Pointer to copy of RecordData from the Data Table. Changes made
62 to this copy will be written to the Data Hub but will not alter
63 the contents of the static Data Table.
64
65 LogRecordData
66 Set *LogRecordData to TRUE to log RecordData to Data Hub.
67 Set *LogRecordData to FALSE when there is no more data to log.
68
69 Returns:
70
71 EFI_SUCCESS
72 All parameters were valid and *RecordData and *LogRecordData have
73 been set.
74
75 EFI_UNSUPPORTED
76 Unexpected RecordType value.
77
78 EFI_INVALID_PARAMETER
79 One of the following parameter conditions was true:
80 RecordLen was zero.
81 RecordData was NULL.
82 LogRecordData was NULL.
83 --*/
84 {
85 STATIC VENDOR_DEVICE mVideoDevicePath = {
86 {
87 HARDWARE_DEVICE_PATH,
88 HW_VENDOR_DP,
89 0x14
90 },
91 EFI_WIN_NT_THUNK_PROTOCOL_GUID,
92 {
93 HARDWARE_DEVICE_PATH,
94 HW_VENDOR_DP,
95 0x18
96 },
97 EFI_WIN_NT_UGA_GUID,
98 0,
99 0,
100 0,
101 0,
102 END
103 };
104
105 STATIC BOOLEAN Done = FALSE;
106
107 //
108 // First check for invalid parameters.
109 //
110 if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
111 return EFI_INVALID_PARAMETER;
112 }
113 //
114 // Then check for unsupported RecordType.
115 //
116 if (RecordType != EFI_MISC_ONBOARD_DEVICE_DATA_RECORD_NUMBER) {
117 return EFI_UNSUPPORTED;
118 }
119 //
120 // Is this the first time through this function?
121 //
122 if (!Done) {
123 //
124 // Yes, this is the first time. Inspect/Change the contents of the
125 // RecordData structure.
126 //
127 //
128 // Any time changes?
129 //
130 // %%TBD
131 //
132 // Set Done flag to TRUE for next pass through this function.
133 // Set *LogRecordData to TRUE so data will get logged to Data Hub.
134 //
135 switch (((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDeviceDescription) {
136 case STR_MISC_ONBOARD_DEVICE_VIDEO_DESCRIPTION:
137 {
138 CopyMem (
139 &((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDevicePath,
140 &mVideoDevicePath,
141 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath)
142 );
143 *RecordLen = *RecordLen - sizeof (EFI_DEVICE_PATH_PROTOCOL) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath);
144 }
145 break;
146 }
147
148 Done = TRUE;
149 *LogRecordData = TRUE;
150 } else {
151 //
152 // No, this is the second time. Reset the state of the Done flag
153 // to FALSE and tell the data logger that there is no more data
154 // to be logged for this record type. If any memory allocations
155 // were made by earlier passes, they must be released now.
156 //
157 Done = FALSE;
158 *LogRecordData = FALSE;
159 }
160
161 return EFI_SUCCESS;
162 }
163
164 /* eof - MiscOnboardDeviceFunction.c */